Skip to content

Commit

Permalink
Merge pull request #784 from TrustlessComputer/fix/studio-game-module
Browse files Browse the repository at this point in the history
fix game module
  • Loading branch information
tonytc13579 authored Sep 5, 2024
2 parents 108604e + acbd3dd commit 2b4642f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/modules/blockchains/detail_v4/hook/useGameModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import {
import * as CSS from 'csstype';
import { ResponsiveValue } from '@chakra-ui/react';

export type GmaeModuleStatus = 'draft' | 'setting_up' | 'running' | 'down';
export type GameModuleStatus = 'draft' | 'setting_up' | 'running' | 'down';

export const useGameModule = () => {
const { order, isUpdateFlow, isBridgeInstalled, isGamingAppsInstalled } =
useChainProvider();
const { order, isUpdateFlow, isGamingAppsInstalled } = useChainProvider();

const gameDAppsIntalledList = useMemo(() => {
return order?.dApps?.filter((item) => item.appCode?.includes('game')) || [];
Expand Down Expand Up @@ -48,8 +47,8 @@ export const useGameModule = () => {
return detailGameMapper;
}, [gameDAppsIntalledList]);

const bridgeModuleStatus: GmaeModuleStatus = useMemo(() => {
if (!isUpdateFlow || !isBridgeInstalled) {
const moduleStatus: GameModuleStatus = useMemo(() => {
if (!isUpdateFlow || !isGamingAppsInstalled) {
return 'draft';
} else {
if (gameDAppsIntalledList.length < 1) {
Expand Down Expand Up @@ -84,9 +83,10 @@ export const useGameModule = () => {
return 'draft';
}
}
}, [isUpdateFlow, isBridgeInstalled, gameDAppsIntalledList]);
}, [isUpdateFlow, isGamingAppsInstalled, gameDAppsIntalledList]);

const lineBridgeStatus = bridgeModuleStatus;
const lineBridgeStatus = moduleStatus;
const lineStatus = moduleStatus;

const statusMapper = useMemo(() => {
let statusCode = 'draft';
Expand All @@ -101,7 +101,7 @@ export const useGameModule = () => {
fontStyle = 'normal';
textDecorationLine = 'none';

switch (bridgeModuleStatus) {
switch (moduleStatus) {
case 'draft':
//Get above value
break;
Expand Down Expand Up @@ -139,10 +139,10 @@ export const useGameModule = () => {
fontStyle,
textDecorationLine,
};
}, [bridgeModuleStatus]);
}, [moduleStatus]);

const getGameTypeIcon = (): ModuleTypeIcon => {
switch (bridgeModuleStatus) {
switch (moduleStatus) {
case 'draft':
return 'Drafting';
case 'setting_up':
Expand All @@ -160,9 +160,10 @@ export const useGameModule = () => {

return {
lineBridgeStatus,
lineStatus,
gameDAppsIntalledList,
statusMapper,
bridgeModuleStatus,
moduleStatus,

getGameTypeIconUrl,
detailGameMapperStatus,
Expand Down

0 comments on commit 2b4642f

Please sign in to comment.