From 044de8ce34ad646fd9f80b8e5c096080d28126a1 Mon Sep 17 00:00:00 2001 From: Stef-00012 Date: Tue, 11 Feb 2025 18:15:54 +0100 Subject: [PATCH] optimize a bit code, re-order imports --- .gitignore | 3 + README.md | 10 +- app.config.ts | 7 +- app/(app)/(files)/files.tsx | 9 +- app/(app)/admin/invites.tsx | 61 ++-- app/(app)/admin/settings.tsx | 28 +- app/(app)/admin/users.tsx | 360 ++++++++++---------- app/(app)/folders.tsx | 435 +++++++++++------------ app/(app)/metrics.tsx | 62 ++-- app/(app)/settings.tsx | 530 +++++++++++++++-------------- app/(app)/urls.tsx | 55 +-- app/index.tsx | 215 ++++++------ constants/adminSettings.ts | 55 +-- constants/invites.ts | 48 ++- constants/sidebar.ts | 18 +- constants/upload.ts | 415 ++++++++++++++++++---- constants/users.ts | 16 +- functions/color.ts | 8 +- functions/util.ts | 11 +- functions/zipline/auth.ts | 2 +- functions/zipline/exports.ts | 2 +- functions/zipline/files.ts | 6 +- functions/zipline/folders.ts | 2 +- functions/zipline/invites.ts | 2 +- functions/zipline/serverActions.ts | 2 +- functions/zipline/settings.ts | 6 +- functions/zipline/stats.ts | 2 +- functions/zipline/tags.ts | 2 +- functions/zipline/urls.ts | 2 +- functions/zipline/user.ts | 2 +- functions/zipline/users.ts | 2 +- hooks/useAuth.ts | 2 +- hooks/useShareIntent.ts | 2 +- hooks/useUpdates.ts | 12 +- package.json | 11 +- styles/metrics.ts | 3 +- 36 files changed, 1368 insertions(+), 1040 deletions(-) diff --git a/.gitignore b/.gitignore index 12f44c9..a366acb 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,10 @@ yarn-error.* # typescript *.tsbuildinfo +# expo prebuild /android /ios + +# misc biome.json package-lock.json \ No newline at end of file diff --git a/README.md b/README.md index 6287ddf..1953111 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,4 @@ This will create an apk but won't automatically install # TODO - [x] Fix keyboard covering TOTP input on login screen -- [ ] Optimize pages by re-rendering only the components that use certain variables and not other unrelated components (~~this is not Spotify~~) - - app/(app)/admin/invites.ts: remove useless settings fetch, move header out of the condition - - app/(app)/admin/settings.ts: re-render individual selects/inputs/switchs instead of the whole page, move header out of the condition - - app/(app)/admin/users.ts: remove useless settings fetch, move header out of the condition - - app/(app)/folders.ts: move header out of the condition - - app/(app)/metrics.ts: move header out of the condition - - app/(app)/settings.ts: re-render individual selects/inputs/switchs instead of the whole page, move header out of the condition - - app/(app)/urls.ts: move header out of the condition - - app/index.ts: move header out of the condition \ No newline at end of file +- [x] Optimize pages by re-rendering only the components that use certain variables and not other unrelated components (~~this is not Spotify~~) \ No newline at end of file diff --git a/app.config.ts b/app.config.ts index b99b0d1..5d29495 100644 --- a/app.config.ts +++ b/app.config.ts @@ -1,11 +1,10 @@ import type { ExpoConfig, ConfigContext } from "expo/config"; const IS_DEV = process.env.APP_VARIANT === "development"; -const IS_RELEASE = process.env.APP_VARIANT === "devrelease"; export default ({ config }: ConfigContext): ExpoConfig => ({ ...config, - name: `Zipline${IS_DEV ? " (Dev)" : IS_RELEASE ? " (Dev Release)" : ""}`, + name: `Zipline${IS_DEV ? " (Dev)" : ""}`, slug: "zipline", version: "1.0.2", orientation: "portrait", @@ -15,7 +14,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({ userInterfaceStyle: "automatic", platforms: ["android"], ios: { - bundleIdentifier: `com.stefdp.zipline${IS_DEV ? ".dev" : IS_RELEASE ? ".devrelease" : ""}` + bundleIdentifier: `com.stefdp.zipline${IS_DEV ? ".dev" : ""}`, }, android: { adaptiveIcon: { @@ -23,7 +22,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({ monochromeImage: "./assets/images/monochromatic-adaptive-icon.png", backgroundColor: "#121317", }, - package: `com.stefdp.zipline${IS_DEV ? ".dev" : IS_RELEASE ? ".devrelease" : ""}` + package: `com.stefdp.zipline${IS_DEV ? ".dev" : ""}`, }, androidStatusBar: { barStyle: "light-content", diff --git a/app/(app)/(files)/files.tsx b/app/(app)/(files)/files.tsx index 452908b..acdda8d 100644 --- a/app/(app)/(files)/files.tsx +++ b/app/(app)/(files)/files.tsx @@ -468,7 +468,10 @@ export default function Files() { }} icon={favorites ? "star" : "star-border"} color="transparent" - iconColor={favorites ? "#f1d01f" : "#2d3f70"} + iconColor={favorites + ? files ? "#f1d01f" : "#f1d01f55" + : files ? "#2d3f70" : "#2d3f7055" + } borderColor="#222c47" borderWidth={2} iconSize={30} @@ -489,7 +492,7 @@ export default function Files() { }} icon="sell" color="transparent" - iconColor="#2d3f70" + iconColor={files ? "#2d3f70" : "#2d3f7055"} borderColor="#222c47" borderWidth={2} iconSize={30} @@ -508,7 +511,7 @@ export default function Files() { }} icon="upload-file" color="transparent" - iconColor="#2d3f70" + iconColor={files ? "#2d3f70" : "#2d3f7055"} borderColor="#222c47" borderWidth={2} iconSize={30} diff --git a/app/(app)/admin/invites.tsx b/app/(app)/admin/invites.tsx index 920c5b4..9a1deb6 100644 --- a/app/(app)/admin/invites.tsx +++ b/app/(app)/admin/invites.tsx @@ -1,5 +1,4 @@ import { ScrollView, Text, View, ToastAndroid } from "react-native"; -import { getSettings } from "@/functions/zipline/settings"; import { Row, Table } from "react-native-reanimated-table"; import { useShareIntent } from "@/hooks/useShareIntent"; import { timeDifference } from "@/functions/util"; @@ -20,7 +19,6 @@ import { } from "@/functions/zipline/invites"; import type { APIInvites, - APISettings, DashURL, } from "@/types/zipline"; @@ -29,7 +27,6 @@ export default function Invites() { useShareIntent(); const [invites, setInvites] = useState(null); - const [settings, setSettings] = useState(null); const [createNewInvite, setCreateNewInvite] = useState(false); @@ -43,10 +40,8 @@ export default function Invites() { useEffect(() => { (async () => { const invites = await getInvites(); - const settings = await getSettings(); setInvites(typeof invites === "string" ? null : invites); - setSettings(typeof settings === "string" ? null : settings); })(); }, []); @@ -136,28 +131,30 @@ export default function Invites() { - {invites && settings && dashUrl ? ( - - - Invites - -