Skip to content

Commit ef2ceb7

Browse files
feat: New Alphaday Mobile (#722)
1 parent ad145b2 commit ef2ceb7

129 files changed

Lines changed: 4282 additions & 9654 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,9 @@
6565
"url": "https://github.com/AlphadayHQ/alphaday/issues"
6666
},
6767
"homepage": "https://github.com/AlphadayHQ/alphaday#readme",
68-
"packageManager": "yarn@1.22.19"
68+
"packageManager": "yarn@1.22.19",
69+
"resolutions": {
70+
"@types/react": "18.2.25",
71+
"@types/react-dom": "18.2.6"
72+
}
6973
}

packages/frontend/capacitor.config.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/frontend/ionic.config.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/frontend/package.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,15 @@
88
"dev": "pwa-assets-generator && VITE_COMMIT=$(git rev-parse --short HEAD) VITE_COMMIT_TS=$(git log -1 --pretty='format:%cd' --date=format:'%Y-%m-%d %H:%M:%S') vite",
99
"dev:ssl": "USE_SSL=true yarn dev --host --port 443",
1010
"build": "pwa-assets-generator && VITE_COMMIT=$(git rev-parse --short HEAD) VITE_COMMIT_TS=$(git log -1 --pretty='format:%cd' --date=format:'%Y-%m-%d %H:%M:%S') vite build",
11-
"build:android:dev": "ionic capacitor build android -- --mode development",
12-
"build:android:prod": "node env-check.cjs && ionic capacitor build android --prod",
13-
"platform:add": "ionic capacitor add",
1411
"generate-pwa-assets": "pwa-assets-generator",
1512
"preview": "vite preview",
1613
"test.e2e": "cypress run",
1714
"test.unit": "vitest",
1815
"lint": "eslint --max-warnings=0 --ignore-path .gitignore . --ext ts --ext tsx",
19-
"resources": "cordova-res ios --skip-config --copy && cordova-res android --skip-config --copy",
2016
"typecheck": "tsc"
2117
},
2218
"dependencies": {
2319
"@alphaday/ui-kit": "0.0.0",
24-
"@capacitor/android": "5.4.1",
25-
"@capacitor/app": "5.0.7",
26-
"@capacitor/core": "5.7.4",
27-
"@capacitor/haptics": "5.0.7",
28-
"@capacitor/keyboard": "5.0.8",
29-
"@capacitor/status-bar": "5.0.7",
30-
"@ionic/react": "7.8.1",
31-
"@ionic/react-router": "7.8.1",
3220
"@react-oauth/google": "0.12.1",
3321
"@reduxjs/toolkit": "1.8.0",
3422
"@sentry/react": "7.109.0",
@@ -43,7 +31,6 @@
4331
"html2canvas": "1.4.1",
4432
"i18next": "23.16.5",
4533
"i18next-browser-languagedetector": "8.2.0",
46-
"ionicons": "7.3.0",
4734
"md5": "2.3.0",
4835
"moment": "2.30.1",
4936
"moment-with-locales-es6": "1.0.1",
@@ -74,8 +61,6 @@
7461
"web3-eth-accounts": "1.9.0"
7562
},
7663
"devDependencies": {
77-
"@capacitor/cli": "5.4.1",
78-
"@ionic/cli": "7.2.0",
7964
"@testing-library/react": "15.0.7",
8065
"@testing-library/react-hooks": "8.0.1",
8166
"@testing-library/user-event": "14.4.3",
@@ -89,7 +74,6 @@
8974
"@vite-pwa/assets-generator": "0.2.4",
9075
"@vitejs/plugin-basic-ssl": "1.2.0",
9176
"@vitejs/plugin-legacy": "5.3.2",
92-
"cordova-res": "0.15.4",
9377
"cypress": "12.17.4",
9478
"dotenv": "16.4.5",
9579
"happy-dom": "20.0.11",

packages/frontend/src/App.tsx

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import { Suspense, memo, useMemo } from "react";
22
import { ErrorModal } from "@alphaday/ui-kit";
3-
import { IonApp, IonRouterOutlet } from "@ionic/react";
4-
import { IonReactRouter } from "@ionic/react-router";
53
import { Web3Modal } from "@web3modal/react";
6-
import { Redirect, Route } from "react-router-dom";
4+
import { BrowserRouter, Route } from "react-router-dom";
75
import * as userStore from "src/api/store/slices/user";
86
import ToastContainer from "src/containers/toasts/ToastContainer";
97
import {
108
useAppInit,
119
useResolvedView,
1210
useViewRoute,
1311
useGaTracker,
12+
useIsMobile,
1413
} from "./api/hooks";
1514
import { useGetRemoteStatusQuery } from "./api/services";
1615
import { useAppDispatch } from "./api/store/hooks";
@@ -20,7 +19,7 @@ import { getRtkErrorCode } from "./api/utils/errorHandling";
2019
import { Logger } from "./api/utils/logging";
2120
import CONFIG from "./config/config";
2221
import PreloaderPage from "./pages/preloader";
23-
import { EDesktopRoutePaths, desktopRoutes, errorRoutes } from "./routes";
22+
import { appRoutes, errorRoutes } from "./routes";
2423
import "@alphaday/ui-kit/global.scss";
2524

2625
const landingPage = CONFIG.SEO.DOMAIN;
@@ -30,6 +29,7 @@ const goToLandingPage = () => {
3029
};
3130

3231
const AppRoutes = () => {
32+
const isMobile = useIsMobile();
3333
useGaTracker();
3434

3535
const dispatch = useAppDispatch();
@@ -39,22 +39,33 @@ const AppRoutes = () => {
3939
});
4040

4141
const resolvedView = useResolvedView();
42-
const { pathContainsHashOrSlug, isRoot, isSuperfeed } = useViewRoute();
42+
const {
43+
pathContainsHashOrSlug,
44+
isRoot,
45+
isBoardsLibrary,
46+
isWidgetsLibrary,
47+
} = useViewRoute();
4348

4449
const errorCode = useMemo<number | undefined>(() => {
4550
/**
4651
* At this moment, we do not support any other routes than the root and the hash/slug routes
4752
* If the path does not contain a hash or slug, we show the 404 error page
4853
*/
49-
if (!pathContainsHashOrSlug && !isRoot && !isSuperfeed) {
54+
if (
55+
!pathContainsHashOrSlug &&
56+
!isRoot &&
57+
!isBoardsLibrary &&
58+
!isWidgetsLibrary
59+
) {
5060
return 404;
5161
}
5262
const errorInfo = error ?? resolvedView.error;
5363
return errorInfo && getRtkErrorCode(errorInfo);
5464
}, [
5565
pathContainsHashOrSlug,
5666
isRoot,
57-
isSuperfeed,
67+
isBoardsLibrary,
68+
isWidgetsLibrary,
5869
error,
5970
resolvedView.error,
6071
]);
@@ -63,7 +74,7 @@ const AppRoutes = () => {
6374
if (error || errorCode) {
6475
return errorRoutes;
6576
}
66-
return desktopRoutes;
77+
return appRoutes;
6778
}, [error, errorCode]);
6879

6980
/**
@@ -76,16 +87,8 @@ const AppRoutes = () => {
7687
location.reload();
7788
}
7889

79-
if (isSuperfeed) {
80-
return (
81-
<Redirect
82-
key={EDesktopRoutePaths.Superfeed}
83-
path={EDesktopRoutePaths.Superfeed}
84-
exact
85-
to={EDesktopRoutePaths.Base}
86-
push
87-
/>
88-
);
90+
if (!isMobile && (isBoardsLibrary || isWidgetsLibrary)) {
91+
window.location.href = "/";
8992
}
9093

9194
return (
@@ -117,24 +120,22 @@ const App: React.FC = () => {
117120

118121
if (!isCookieEnabled()) {
119122
return (
120-
<IonApp className="theme-dark">
123+
<div className="theme-dark app-container">
121124
<ErrorModal
122125
title="Cookie Error"
123126
onClose={goToLandingPage}
124127
errorMessage="Cookies must be enabled to use Alphaday."
125128
size="sm"
126129
/>
127-
</IonApp>
130+
</div>
128131
);
129132
}
130133

131134
return (
132-
<IonApp className="theme-dark">
133-
<IonReactRouter>
134-
<IonRouterOutlet>
135-
<AppRoutes />
136-
</IonRouterOutlet>
137-
</IonReactRouter>
135+
<div className="theme-dark app-container">
136+
<BrowserRouter>
137+
<AppRoutes />
138+
</BrowserRouter>
138139
<Web3Modal
139140
projectId={CONFIG.WALLET_CONNECT.PROJECT_ID}
140141
ethereumClient={walletConnectProvider}
@@ -152,7 +153,7 @@ const App: React.FC = () => {
152153
duration={CONFIG.UI.TOAST_DURATION}
153154
className="fontGroup-supportBold"
154155
/>
155-
</IonApp>
156+
</div>
156157
);
157158
};
158159

0 commit comments

Comments
 (0)