Skip to content

Commit

Permalink
Add online platform selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ctizen committed Sep 19, 2024
1 parent cafaa9b commit 0eac634
Show file tree
Hide file tree
Showing 31 changed files with 1,725 additions and 554 deletions.
618 changes: 487 additions & 131 deletions Bragi/yarn.lock

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions Common/generated/Common/EventData.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions Common/generated/Common/PlatformType.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Common/generated/GPBMetadata/Proto/Atoms.php
Binary file not shown.
7 changes: 7 additions & 0 deletions Common/proto/atoms.proto
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ message EventData {
bool is_rating_shown = 16;
bool achievements_shown = 17;
bool allow_view_other_tables = 18;
PlatformType platform_id = 19;
}

message TableState {
Expand Down Expand Up @@ -591,6 +592,12 @@ enum EndingPolicy {
ENDING_POLICY_EP_END_AFTER_HAND = 2;
}

enum PlatformType {
PLATFORM_TYPE_UNSPECIFIED = 0;
PLATFORM_TYPE_TENHOUNET = 1;
PLATFORM_TYPE_MAHJONGSOUL = 2;
}

message RulesetConfig {
ComplexUma complex_uma = 1;
EndingPolicy ending_policy = 2;
Expand Down
6 changes: 1 addition & 5 deletions Forseti/app/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const Layout: React.FC<React.PropsWithChildren> = ({ children }) => {

return (
<actionButtonCtx.Provider value={actionButtonRef}>
<authCtx.Provider value={{ isLoggedIn, setIsLoggedIn }}>
<authCtx.Provider value={{ isLoggedIn, setIsLoggedIn, isSuperadmin, setIsSuperadmin }}>
<modalsCtx.Provider
value={{
showStopEventModal,
Expand Down Expand Up @@ -366,10 +366,8 @@ export const Layout: React.FC<React.PropsWithChildren> = ({ children }) => {
header={
<AppHeader
title={title}
isSuperadmin={isSuperadmin}
eventData={eventData}
dark={dark}
isLoggedIn={isLoggedIn}
toggleColorScheme={toggleColorScheme}
toggleDimmed={toggleDimmed}
saveLang={saveLang}
Expand All @@ -381,8 +379,6 @@ export const Layout: React.FC<React.PropsWithChildren> = ({ children }) => {
<Navbar.Section grow component={ScrollArea} mx='-xs' px='xs'>
<MainMenu
title={title}
isLoggedIn={isLoggedIn}
isSuperadmin={isSuperadmin}
dark={dark}
toggleColorScheme={toggleColorScheme}
toggleDimmed={toggleDimmed}
Expand Down
114 changes: 114 additions & 0 deletions Forseti/app/clients/proto/atoms.pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export type EndingPolicy =
| "ENDING_POLICY_EP_ONE_MORE_HAND"
| "ENDING_POLICY_EP_END_AFTER_HAND";

export type PlatformType =
| "PLATFORM_TYPE_UNSPECIFIED"
| "PLATFORM_TYPE_TENHOUNET"
| "PLATFORM_TYPE_MAHJONGSOUL";

export interface AccessRules {
rules: Record<string, AccessRules.Rules["value"] | undefined>;
}
Expand Down Expand Up @@ -509,6 +514,7 @@ export interface EventData {
isRatingShown: boolean;
achievementsShown: boolean;
allowViewOtherTables: boolean;
platformId: PlatformType;
}

export interface TableState {
Expand Down Expand Up @@ -978,6 +984,52 @@ export const EndingPolicy = {
},
} as const;

export const PlatformType = {
PLATFORM_TYPE_UNSPECIFIED: "PLATFORM_TYPE_UNSPECIFIED",
PLATFORM_TYPE_TENHOUNET: "PLATFORM_TYPE_TENHOUNET",
PLATFORM_TYPE_MAHJONGSOUL: "PLATFORM_TYPE_MAHJONGSOUL",
/**
* @private
*/
_fromInt: function (i: number): PlatformType {
switch (i) {
case 0: {
return "PLATFORM_TYPE_UNSPECIFIED";
}
case 1: {
return "PLATFORM_TYPE_TENHOUNET";
}
case 2: {
return "PLATFORM_TYPE_MAHJONGSOUL";
}
// unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date.
default: {
return i as unknown as PlatformType;
}
}
},
/**
* @private
*/
_toInt: function (i: PlatformType): number {
switch (i) {
case "PLATFORM_TYPE_UNSPECIFIED": {
return 0;
}
case "PLATFORM_TYPE_TENHOUNET": {
return 1;
}
case "PLATFORM_TYPE_MAHJONGSOUL": {
return 2;
}
// unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date.
default: {
return i as unknown as number;
}
}
},
} as const;

export const AccessRules = {
/**
* Serializes AccessRules to protobuf.
Expand Down Expand Up @@ -6298,6 +6350,7 @@ export const EventData = {
isRatingShown: false,
achievementsShown: false,
allowViewOtherTables: false,
platformId: PlatformType._fromInt(0),
...msg,
};
},
Expand Down Expand Up @@ -6357,6 +6410,9 @@ export const EventData = {
if (msg.allowViewOtherTables) {
writer.writeBool(18, msg.allowViewOtherTables);
}
if (msg.platformId && PlatformType._toInt(msg.platformId)) {
writer.writeEnum(19, PlatformType._toInt(msg.platformId));
}
return writer;
},

Expand Down Expand Up @@ -6434,6 +6490,10 @@ export const EventData = {
msg.allowViewOtherTables = reader.readBool();
break;
}
case 19: {
msg.platformId = PlatformType._fromInt(reader.readEnum());
break;
}
default: {
reader.skipField();
break;
Expand Down Expand Up @@ -8328,6 +8388,52 @@ export const EndingPolicyJSON = {
},
} as const;

export const PlatformTypeJSON = {
PLATFORM_TYPE_UNSPECIFIED: "PLATFORM_TYPE_UNSPECIFIED",
PLATFORM_TYPE_TENHOUNET: "PLATFORM_TYPE_TENHOUNET",
PLATFORM_TYPE_MAHJONGSOUL: "PLATFORM_TYPE_MAHJONGSOUL",
/**
* @private
*/
_fromInt: function (i: number): PlatformType {
switch (i) {
case 0: {
return "PLATFORM_TYPE_UNSPECIFIED";
}
case 1: {
return "PLATFORM_TYPE_TENHOUNET";
}
case 2: {
return "PLATFORM_TYPE_MAHJONGSOUL";
}
// unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date.
default: {
return i as unknown as PlatformType;
}
}
},
/**
* @private
*/
_toInt: function (i: PlatformType): number {
switch (i) {
case "PLATFORM_TYPE_UNSPECIFIED": {
return 0;
}
case "PLATFORM_TYPE_TENHOUNET": {
return 1;
}
case "PLATFORM_TYPE_MAHJONGSOUL": {
return 2;
}
// unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date.
default: {
return i as unknown as number;
}
}
},
} as const;

export const AccessRulesJSON = {
/**
* Serializes AccessRules to JSON.
Expand Down Expand Up @@ -12921,6 +13027,7 @@ export const EventDataJSON = {
isRatingShown: false,
achievementsShown: false,
allowViewOtherTables: false,
platformId: PlatformType._fromInt(0),
...msg,
};
},
Expand Down Expand Up @@ -12985,6 +13092,9 @@ export const EventDataJSON = {
if (msg.allowViewOtherTables) {
json["allowViewOtherTables"] = msg.allowViewOtherTables;
}
if (msg.platformId && PlatformTypeJSON._toInt(msg.platformId)) {
json["platformId"] = msg.platformId;
}
return json;
},

Expand Down Expand Up @@ -13058,6 +13168,10 @@ export const EventDataJSON = {
if (_allowViewOtherTables_) {
msg.allowViewOtherTables = _allowViewOtherTables_;
}
const _platformId_ = json["platformId"] ?? json["platform_id"];
if (_platformId_) {
msg.platformId = PlatformType._fromInt(_platformId_);
}
return msg;
},
};
Expand Down
15 changes: 1 addition & 14 deletions Forseti/app/components/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,13 @@ const useStyles = createStyles((theme) => ({
}));

export const AppHeader: React.FC<{
isLoggedIn: boolean;
isSuperadmin: boolean;
eventData: Event | null;
title?: string;
dark: boolean;
toggleColorScheme: () => void;
toggleDimmed: () => void;
saveLang: (lang: string) => void;
}> = ({
title,
isSuperadmin,
isLoggedIn,
eventData,
dark,
toggleColorScheme,
toggleDimmed,
saveLang,
}) => {
}> = ({ title, eventData, dark, toggleColorScheme, toggleDimmed, saveLang }) => {
const { classes } = useStyles();
const i18n = useI18n();

Expand Down Expand Up @@ -104,8 +93,6 @@ export const AppHeader: React.FC<{
/>
<MainMenu
title={title}
isLoggedIn={isLoggedIn}
isSuperadmin={isSuperadmin}
dark={dark}
closeMenu={closeMenu}
toggleColorScheme={toggleColorScheme}
Expand Down
Loading

0 comments on commit 0eac634

Please sign in to comment.