Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: event state changed into number #27

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/AllEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const AllEvent: React.FC = () => {
'gmtRegistrationEnd': 'UNLIMITED',
'gmtRegistrationStart': 'UNLIMITED',
'tag': 'HIDDEN',
'state': 'IN_PROGRESS',
'state': 3,
'eventType': {
'id': 0,
'typeName': 'HIDDEN',
Expand Down
34 changes: 17 additions & 17 deletions src/components/EventCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const EventCard: React.FC<EventCardProps> = ({ event, isShadow }) => {
const titleWidth = isPlatform('ios') ? "100%" : "calc(100% - 60px)";

const settingStore = useSettingStore();

useEffect(() => {
document.querySelectorAll('.eventCard').forEach((element) => {
if (settingStore.isShowEventCardAnime) {
Expand All @@ -37,20 +37,20 @@ const EventCard: React.FC<EventCardProps> = ({ event, isShadow }) => {
CANCELED(4, "已取消"),
ENDED(5, "已结束");
*/
switch (event.state) {
case 'NOT_STARTED':
return '1';
case 'CHECKING_IN':
return '2';
case 'IN_PROGRESS':
return '3';
case 'CANCELED':
return '4';
case 'ENDED':
return '5';
default:
return '0';
}
// switch (event.state) {
// case 'NOT_STARTED':
// return '1';
// case 'CHECKING_IN':
// return '2';
// case 'IN_PROGRESS':
// return '3';
// case 'CANCELED':
// return '4';
// case 'ENDED':
// return '5';
// default:
// return '0';
// }
}

if (event.id === null) {
Expand Down Expand Up @@ -134,8 +134,8 @@ const EventCard: React.FC<EventCardProps> = ({ event, isShadow }) => {
</div>
</IonCardContent>
<div className='stateWarpper'>
{states[stateInfo()]}
<div className='stateCircle' style={{ '--circle-color': stateColor[stateInfo()] }}></div>
{states[event.state]}
<div className='stateCircle' style={{ '--circle-color': stateColor[event.state] }}></div>
</div>
</IonCard>
);
Expand Down
2 changes: 1 addition & 1 deletion src/context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Event {
gmtRegistrationStart: string;
id: number;
location: string;
state: string;
state: number;
tag: string;
title: string;
[property: string]: any;
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const EventPage: React.FC = () => {
);
} else {
return (
<IonButton fill="outline" size="small" onClick={subscribe} disabled={event.state !== "NOT_STARTED" && event.state !== "CHECKING_IN"} className='subscribeButton'>
<IonButton fill="outline" size="small" onClick={subscribe} disabled={event.state !== 1 && event.state !== 2} className='subscribeButton'>
<IonIcon icon={alarmSharp}></IonIcon>
</IonButton>
);
Expand Down Expand Up @@ -159,7 +159,7 @@ const EventPage: React.FC = () => {
);
} else {
return (
<IonButton size="small" onClick={register} disabled={event.state !== "REGISTRATION"} className='registerButton'>
<IonButton size="small" onClick={register} disabled={event.state === 4 || event.state === 5} className='registerButton'>
<IonIcon icon={statsChartSharp}></IonIcon>报名
</IonButton>
);
Expand Down