Skip to content

Commit

Permalink
feat: Washer screen new UI (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
84634E1A607A committed Sep 25, 2023
1 parent 86eb84c commit edd7044
Show file tree
Hide file tree
Showing 7 changed files with 553 additions and 6 deletions.
10 changes: 10 additions & 0 deletions apps/thu-info-app/src/assets/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,4 +573,14 @@ export default {
selectSemester: "Select Semester",
calendarNoCurrentLang: "No calendar for current language",
calendarNotFound: "Calendar not found",
ziJingDorm: "Zijing Building",
nanQuDorm: "Building",
shuangQingDorm: "Shuangqing Apartment",
otherDorm: "Other Locations",
favourites: "Favourites",
washerIdle: "Idle",
minutesAbbr: "mins",
washerError: "Error",
washerCredit:
"Special thanks to washer.sdevs.top for our old washer web UI; special thanks to gtxzsxxk@github for the inspiration of the current UI.",
};
10 changes: 10 additions & 0 deletions apps/thu-info-app/src/assets/translations/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,4 +540,14 @@ export default {
selectSemester: "选择学期",
calendarNoCurrentLang: "暂无当前语言的校历",
calendarNotFound: "未找到校历",
ziJingDorm: "紫荆公寓",
nanQuDorm: "南区宿舍",
shuangQingDorm: "双清公寓",
otherDorm: "其他位置",
favourites: "收藏",
washerIdle: "空闲",
minutesAbbr: "分钟",
washerError: "故障",
washerCredit:
"感谢 washer.sdevs.top 为我们提供了旧版的 Web UI;感谢 gtxzsxxk@github 同学提供的 UI 灵感",
};
18 changes: 14 additions & 4 deletions apps/thu-info-app/src/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ import {
WaterSelectBrandScreen,
WaterSelectTicketNumberScreen,
} from "../ui/home/water";
import {WasherWebScreen} from "../ui/home/washerWeb";
import {
WasherDetailProps,
WasherDetailScreen,
WasherScreen,
} from "../ui/home/washer";
import {ElectricityScreen} from "../ui/home/electricity";
import {EleRecordScreen} from "../ui/home/eleRecord";
import {LoseCardScreen} from "../ui/home/loseCard";
Expand Down Expand Up @@ -248,7 +252,8 @@ type HomeStackParamList = {
Qzyq: QzyqSelectParams;
WaterSelectBrand: undefined;
WaterSelectTicketNumber: QzyqSelectParams;
WasherWeb: undefined;
Washer: undefined;
WasherDetail: WasherDetailProps;
Sports: undefined;
SportsDetail: {info: SportsIdInfo};
SportsSelect: SportsSelectParams;
Expand Down Expand Up @@ -824,10 +829,15 @@ export const Root = () => {
options={{title: getStr("qzyq")}}
/>
<Stack.Screen
name="WasherWeb"
component={WasherWebScreen}
name="Washer"
component={WasherScreen}
options={{title: getStr("washer")}}
/>
<Stack.Screen
name={"WasherDetail"}
component={WasherDetailScreen}
options={({route}) => ({title: route.params.name})}
/>
<Stack.Screen
name="MyhomeLogin"
component={MyhomeLoginScreen}
Expand Down
2 changes: 2 additions & 0 deletions apps/thu-info-app/src/redux/slices/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface ConfigState {
studentNotified: boolean | undefined;
disableBackgroundSecurityWarning: boolean | undefined;
is24Hour: boolean | undefined;
washerFavourites: string[] | undefined;
}

const initialState: ConfigState = {
Expand Down Expand Up @@ -72,6 +73,7 @@ const initialState: ConfigState = {
studentNotified: false,
disableBackgroundSecurityWarning: false,
is24Hour: false,
washerFavourites: [],
};

// Reference: https://stackoverflow.com/questions/51691235/typescript-map-union-type-to-another-union-type
Expand Down
2 changes: 1 addition & 1 deletion apps/thu-info-app/src/ui/home/dorm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const DormScreen = ({navigation}: {navigation: RootNav}) => {
icon={<IconWasher />}
onPress={() => {
addUsageStat(FunctionType.WasherInfo);
navigation.navigate("WasherWeb");
navigation.navigate("Washer");
}}
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion apps/thu-info-app/src/ui/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ const getHomeFunctions = (
onPress={() => {
addUsageStat(FunctionType.WasherInfo);
updateTop5("washer");
navigation.navigate("WasherWeb");
navigation.navigate("Washer");
}}>
<IconWasher width={iconSize} height={iconSize} />
</HomeIcon>,
Expand Down
Loading

0 comments on commit edd7044

Please sign in to comment.