- GameDetails/context menus: chakra context-menu dep replaced with MenuRoot shims, hover lift kept, FixedSelect play-status control, Link/Text/Separator prop renames - Features/Summary/SystemRequirements: Jodit + modal flows moved onto Dialog shims, v3 Button/Tag/Link tokens, carousel slide kept as-is - Preserves legacy dark card/menu surfaces via gray.950 -> v2 gray.700 mapping in the theme
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
import { Data } from '../../models/game'
|
|
import agent from "../../api/agent";
|
|
import {playStatusValues} from "../../componentUtils/SelectValues";
|
|
import {Select} from "../FixedSelect";
|
|
import {ImmutableObject} from "@hookstate/core";
|
|
|
|
|
|
interface Props {
|
|
game: Data | ImmutableObject<Data>
|
|
playState: string
|
|
setPlayState: any
|
|
}
|
|
|
|
const GamePlayStatus = ({game, playState, setPlayState}: Props) => {
|
|
|
|
const handleClick = async (label: string, playStatus: string) => {
|
|
try {
|
|
setPlayState(playStatus)
|
|
await agent.Games.playStatus(game._id, {
|
|
accessedBy: [{
|
|
playStatus
|
|
}]
|
|
})
|
|
} catch (err) {
|
|
console.error(`${label}: ${err}`)
|
|
}
|
|
}
|
|
|
|
return <Select
|
|
id={'playStatus'}
|
|
name={'playStatus'}
|
|
value={{
|
|
value: playState,
|
|
label: playState,
|
|
}}
|
|
onChange={(e: any) => {
|
|
if(e === null) return
|
|
handleClick(e.value, e.label)
|
|
}}
|
|
size={'sm'}
|
|
options={playStatusValues}
|
|
chakraStyles={{
|
|
container: (provided: any) => ({
|
|
...provided,
|
|
width: "150px"
|
|
})
|
|
}}
|
|
/>
|
|
};
|
|
|
|
export default GamePlayStatus;
|