diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1a028fc3a..a1cb39fe1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -24,7 +24,7 @@ If applicable, add screenshots to help explain your problem. **Environment:** -- OS: [e.g. iOS] +- OS: [e.g. Windows] - Browser : [e.g. IE] - Version [e.g. 9] diff --git a/.gitignore b/.gitignore index 3d15193ae..3d4574c59 100644 --- a/.gitignore +++ b/.gitignore @@ -33,8 +33,5 @@ cloudflare/public/* .wrangler **/cloudflare/wrangler.toml -# mobile -mobile/.expo - # data data/nodemon.json diff --git a/mobile/app.json b/mobile/app.json deleted file mode 100644 index 9deaa0449..000000000 --- a/mobile/app.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "expo": { - "name": "DzCode i/o", - "slug": "dzcode", - "version": "5.3.6", - "orientation": "portrait", - "icon": "./src/assets/png/icon.png", - "scheme": "dzcode", - "userInterfaceStyle": "automatic", - "splash": { - "image": "./src/assets/png/splash.png", - "resizeMode": "contain", - "backgroundColor": "#000" - }, - "updates": { - "fallbackToCacheTimeout": 0, - "url": "https://u.expo.dev/92897cc7-1f47-44ff-9a48-788b82c4d57b" - }, - "assetBundlePatterns": ["**/*"], - "ios": { - "supportsTablet": true, - "bundleIdentifier": "io.dzcode.mobile", - "buildNumber": "5.3.6", - "userInterfaceStyle": "automatic" - }, - "android": { - "adaptiveIcon": { - "foregroundImage": "./src/assets/png/adaptive-icon.png", - "backgroundColor": "#000" - }, - "permissions": [], - "package": "io.dzcode.mobile", - "versionCode": 536, - "userInterfaceStyle": "automatic" - }, - "web": { - "favicon": "./src/assets/png/favicon.png" - }, - "plugins": ["sentry-expo"], - "hooks": { - "postExport": [ - { - "file": "sentry-expo/upload-sourcemaps", - "config": { - "organization": "zakman.dev", - "project": "dzcode", - "authToken": false - } - } - ] - }, - "extra": { - "eas": { - "projectId": "92897cc7-1f47-44ff-9a48-788b82c4d57b" - } - }, - "runtimeVersion": { - "policy": "sdkVersion" - } - } -} diff --git a/mobile/babel.config.js b/mobile/babel.config.js deleted file mode 100644 index af27361c5..000000000 --- a/mobile/babel.config.js +++ /dev/null @@ -1,40 +0,0 @@ -const { readFileSync } = require("fs"); -const internalIp = require("internal-ip"); -const localIP = internalIp.v4.sync(); - -let bundleInfo = { version: require("./package.json").version, environment: "development" }; -try { - bundleInfo = JSON.parse(readFileSync(".bundle-info.json").toString()); -} catch (error) { - /**/ -} -module.exports = function (api) { - api.cache(true); - return { - presets: ["babel-preset-expo"], - plugins: [ - "react-native-reanimated/plugin", - [ - "transform-define", - { - "process.env.LOCAL_API_HOST": localIP, - "window.bundleInfo": bundleInfo, - }, - ], - [ - "module-resolver", - { - root: ["../"], - alias: { - src: "./src", - }, - }, - ], - ], - env: { - production: { - plugins: ["react-native-paper/babel"], - }, - }, - }; -}; diff --git a/mobile/eas.json b/mobile/eas.json deleted file mode 100644 index 46a0b6d00..000000000 --- a/mobile/eas.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "cli": { - "version": ">= 3.8.1" - }, - "build": { - "development": { - "channel": "development", - "developmentClient": true, - "distribution": "internal", - "ios": { - "resourceClass": "m-medium" - } - }, - "stage": { - "channel": "stage", - "distribution": "internal", - "ios": { - "resourceClass": "m-medium" - } - }, - "production": { - "channel": "production", - "ios": { - "resourceClass": "m-medium" - } - } - }, - "submit": { - "production": {} - } -} diff --git a/mobile/index.js b/mobile/index.js deleted file mode 100644 index b63547226..000000000 --- a/mobile/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import { registerRootComponent } from "expo"; - -import { App } from "./src/_entry/app"; - -// registerRootComponent calls AppRegistry.registerComponent('main', () => App); -// It also ensures that whether you load the app in Expo Go or in a native build, -// the environment is set up appropriately -registerRootComponent(App); diff --git a/mobile/jest.config.js b/mobile/jest.config.js deleted file mode 100644 index 83ea699f6..000000000 --- a/mobile/jest.config.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - preset: "jest-expo", - transformIgnorePatterns: [ - "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|@sentry|native-base|react-native-svg)", - ], - testEnvironment: "jsdom", -}; diff --git a/mobile/metro.config.js b/mobile/metro.config.js deleted file mode 100644 index be2616c70..000000000 --- a/mobile/metro.config.js +++ /dev/null @@ -1,28 +0,0 @@ -// Learn more https://docs.expo.dev/guides/monorepos -const { getDefaultConfig } = require("expo/metro-config"); -const exclusionList = require("metro-config/src/defaults/exclusionList"); -const path = require("path"); -const findWorkspaceRoot = require("find-yarn-workspace-root"); - -// Find the project and workspace directories -// This can be replaced with `find-yarn-workspace-root` -const workspaceRoot = findWorkspaceRoot(__dirname); -const projectRoot = __dirname; - -const config = getDefaultConfig(projectRoot); - -// 1. Watch all files within the monorepo -config.watchFolders = [workspaceRoot]; -// 2. Let Metro know where to resolve packages and in what order -config.resolver.nodeModulesPaths = [ - path.resolve(projectRoot, "node_modules"), - path.resolve(workspaceRoot, "node_modules"), -]; -// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths` -config.resolver.disableHierarchicalLookup = true; -// 4. Ignore `./api` deployment artifacts -config.resolver.blacklistRE = exclusionList([ - new RegExp(`${path.resolve(workspaceRoot, "api/oracle-cloud/build").replace(/\//g, "\\/")}\\/.*`), -]); - -module.exports = config; diff --git a/mobile/package.json b/mobile/package.json deleted file mode 100644 index a2ca443b1..000000000 --- a/mobile/package.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "name": "@dzcode.io/mobile", - "version": "5.3.6", - "author": { - "email": "omarbelghaouti@gmail.com", - "name": "Omar Belghaouti", - "url": "https://omar-belghaouti.web.app" - }, - "dependencies": { - "@dzcode.io/api": "*", - "@dzcode.io/models": "*", - "@dzcode.io/ui-mobile": "*", - "@dzcode.io/utils": "*", - "@sentry/react-native": "4.13.0", - "debounce": "^1.2.1", - "expo": "~48.0.9", - "expo-application": "~5.1.1", - "expo-constants": "~14.2.1", - "expo-device": "~5.2.1", - "expo-status-bar": "~1.4.4", - "expo-updates": "~0.16.4", - "react": "18.2.0", - "react-native": "0.71.6", - "react-redux": "^7.2.6", - "redux": "^4.1.2", - "redux-thunk": "^2.4.1", - "sentry-expo": "~6.1.0" - }, - "devDependencies": { - "@babel/core": "^7.20.0", - "@dzcode.io/tooling": "*", - "@expo/ngrok": "^4.1.0", - "@types/debounce": "^1.2.0", - "@types/react": "~18.0.14", - "@types/react-test-renderer": "^18.0.0", - "babel-plugin-transform-define": "^2.0.0", - "eas-cli": "^3.8.1", - "internal-ip": "^6.2.0", - "jest-expo": "^48.0.2", - "react-test-renderer": "^18.2.0" - }, - "engines": { - "node": ">=16", - "yarn": ">=1.4.2" - }, - "license": "MIT", - "lint-staged": { - "*.*": [ - "yarn lint:eslint --fix", - "yarn lint:prettier --write" - ] - }, - "main": "index.js", - "private": true, - "repository": { - "type": "git", - "repository": "https://github.com/dzcode-io/dzcode.io.git" - }, - "scripts": { - "build": "lerna run build:alone --scope=@dzcode.io/mobile --include-dependencies --stream", - "build:alone:watch": "tsc --watch --preserveWatchOutput", - "build:android": "eas build -p android --no-wait --non-interactive", - "build:ios": "eas build -p ios --no-wait --non-interactive", - "build:production": "yarn build:ios --profile production && yarn build:android --profile production", - "build:stage": "yarn build:ios --profile stage && yarn build:android --profile stage", - "build:watch": "lerna run build:alone:watch --scope=@dzcode.io/mobile --include-dependencies --parallel", - "clean": "lerna run clean:alone --scope=@dzcode.io/mobile --include-dependencies --stream", - "clean:alone": "rimraf .expo dist", - "combine:components": "rnhc combine -c", - "combine:screens": "rnhc combine -s", - "create:component": "rnhc create -c", - "create:navigation:bottom-tabs": "rnhc create -n bottom-tabs", - "create:navigation:drawer": "rnhc create -n drawer", - "create:navigation:material-bottom-tabs": "rnhc create -n material-bottom-tabs", - "create:navigation:material-top-tabs": "rnhc create -n material-top-tabs", - "create:navigation:native-stack": "rnhc create -n native-stack", - "create:navigation:stack": "rnhc create -n stack", - "create:screen": "rnhc create -s", - "delete:component": "rnhc delete -c", - "delete:navigation": "rnhc delete -n", - "delete:screen": "rnhc delete -s", - "deploy": "eas update --channel production --message \"update\" --non-interactive", - "deploy:stg": "eas update --channel stage --message \"update\" --non-interactive", - "eas-build-post-install": "yarn build", - "generate:bundle-info": "ts-node ../packages/tooling/bundle-info.ts", - "generate:sentry-release": "ts-node ../packages/tooling/sentry-release.ts mobile dist", - "lint": "yarn build && yarn lint:alone", - "lint:alone": "yarn lint:eslint . && yarn lint:prettier --check . && yarn lint:tsc", - "lint:eslint": "eslint --config ../packages/tooling/.eslintrc.json --ignore-path ../packages/tooling/.eslintignore --report-unused-disable-directives", - "lint:fix": "yarn build && yarn lint:fix:alone", - "lint:fix:alone": "yarn lint:eslint --fix . && yarn lint:prettier --write .", - "lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --log-level warn", - "lint:tsc": "tsc --noEmit", - "start:dev": "echo \" \n\\033[0;32mPlease run in a separate terminal session the following command:\n \n\\033[0;32myarn --cwd=mobile start:expo\n \n \"", - "start:expo": "rimraf .bundle-info.json && expo start --port 1010", - "test": "yarn build && yarn test:alone", - "test:alone": "jest --rootDir .", - "test:watch": "npm-run-all build --parallel build:watch \"test:alone --watch {@}\" --" - } -} diff --git a/mobile/src/_entry/__snapshots__/app.spec.tsx.snap b/mobile/src/_entry/__snapshots__/app.spec.tsx.snap deleted file mode 100644 index e5a86eb70..000000000 --- a/mobile/src/_entry/__snapshots__/app.spec.tsx.snap +++ /dev/null @@ -1,25 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders correctly 1`] = ` - - - -`; diff --git a/mobile/src/_entry/app.spec.tsx b/mobile/src/_entry/app.spec.tsx deleted file mode 100644 index cb014793c..000000000 --- a/mobile/src/_entry/app.spec.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { Component } from "react"; -import renderer from "react-test-renderer"; - -import { App } from "./app"; - -jest.useFakeTimers(); - -jest.mock("@sentry/react-native", () => ({ init: () => jest.fn() })); - -jest.mock("expo-status-bar"); - -const mock = jest.requireMock("react-native-reanimated"); -jest.mock("react-native-reanimated", () => ({ - ...mock, - useSharedValue: jest.fn().mockReturnValue(0), - useAnimatedStyle: jest.fn().mockReturnValue({}), - useAnimatedScrollHandler: jest.fn().mockReturnValue({}), - createAnimatedComponent: (component: Component) => jest.fn().mockReturnValue(component), - __reanimatedWorkletInit: jest.fn(), - ScrollView: "ScrollView", -})); - -jest.mock("@gorhom/bottom-sheet", () => { - require("react-native-reanimated/mock"); -}); - -(global as any).__reanimatedWorkletInit = jest.fn(); // eslint-disable-line @typescript-eslint/no-explicit-any - -jest.mock("@react-navigation/drawer", () => ({ - createDrawerNavigator: jest.fn().mockReturnValue({ - Navigator: jest.fn().mockReturnValue(null), - Screen: jest.fn().mockReturnValue(null), - }), -})); - -it("renders correctly", () => { - const render = renderer.create(); - - expect(render).toMatchSnapshot(); -}); diff --git a/mobile/src/_entry/app.tsx b/mobile/src/_entry/app.tsx deleted file mode 100644 index 5322b16e5..000000000 --- a/mobile/src/_entry/app.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { NavigationContainer } from "@dzcode.io/ui-mobile/dist/navigation/navigation-container"; -import { darkTheme, defaultTheme } from "@dzcode.io/ui-mobile/dist/theme"; -import { ThemeProvider } from "@dzcode.io/ui-mobile/dist/theme/theme-provider"; -import { StatusBar } from "expo-status-bar"; -import { FC, useEffect } from "react"; -import { Provider, useDispatch } from "react-redux"; -import * as Sentry from "sentry-expo"; -import { AppDispatch, store } from "src/redux"; -import { init } from "src/redux/actions/general"; -import { useGeneralSliceSelector } from "src/redux/reducers/general/slice"; -import { Navigation } from "src/screens/navigation"; -import { getEnv } from "src/utils/env"; - -const env = getEnv(); - -if (env !== "development") { - Sentry.init({ - dsn: "https://aa3f0c7f4b234747a706fb60d84a190d@o953637.ingest.sentry.io/5904343", - enableInExpoDevelopment: true, - environment: env, - debug: env !== "production", - release: `mobile@${window.bundleInfo.version}`, - }); -} - -const AssumeRedux: FC = () => { - const { theme: themeName } = useGeneralSliceSelector(); - const dispatch = useDispatch(); - - useEffect(() => { - dispatch(init(null)); - }, []); - - const themes = { - dark: darkTheme, - light: defaultTheme, - }; - const theme = themes[themeName]; - - return ( - - - - - - ); -}; - -export const App = () => ( - // @TODO-ZM: to add ErrorBoundary - - - - -); diff --git a/mobile/src/_test/pre-test.ts b/mobile/src/_test/pre-test.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/mobile/src/_test/setup.ts b/mobile/src/_test/setup.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/mobile/src/assets/png/adaptive-icon.png b/mobile/src/assets/png/adaptive-icon.png deleted file mode 100644 index 7832a54a4..000000000 Binary files a/mobile/src/assets/png/adaptive-icon.png and /dev/null differ diff --git a/mobile/src/assets/png/favicon.png b/mobile/src/assets/png/favicon.png deleted file mode 100644 index 03bdf1047..000000000 Binary files a/mobile/src/assets/png/favicon.png and /dev/null differ diff --git a/mobile/src/assets/png/icon.png b/mobile/src/assets/png/icon.png deleted file mode 100644 index 83c5527c7..000000000 Binary files a/mobile/src/assets/png/icon.png and /dev/null differ diff --git a/mobile/src/assets/png/splash.png b/mobile/src/assets/png/splash.png deleted file mode 100644 index 2c5652ee4..000000000 Binary files a/mobile/src/assets/png/splash.png and /dev/null differ diff --git a/mobile/src/config/index.ts b/mobile/src/config/index.ts deleted file mode 100644 index 80e8ae5ad..000000000 --- a/mobile/src/config/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { fsConfig } from "@dzcode.io/utils/dist/config"; -import { getEnv } from "src/utils/env"; - -export const fullstackConfig = fsConfig(getEnv(), { hostname: process.env.LOCAL_API_HOST }); diff --git a/mobile/src/redux/actions/articles-screen/index.ts b/mobile/src/redux/actions/articles-screen/index.ts deleted file mode 100644 index 146af80fa..000000000 --- a/mobile/src/redux/actions/articles-screen/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; -import { fetchV2 } from "src/utils/fetch"; - -export const fetchArticles = createAsyncThunk("articlesScreen/fetchArticles", async () => { - try { - const { articles } = await fetchV2("api:Articles", {}); - return articles; - } catch (error: any) { - return error.message; - } -}); - -export const fetchArticle = createAsyncThunk( - "articlesScreen/fetchArticle", - async (slug: string) => { - try { - const { article } = await fetchV2(`api:Articles/:slug`, { - params: { slug }, - }); - return article; - } catch (error: any) { - return error.message; - } - }, -); diff --git a/mobile/src/redux/actions/contribute-screen/index.ts b/mobile/src/redux/actions/contribute-screen/index.ts deleted file mode 100644 index 70c4ba845..000000000 --- a/mobile/src/redux/actions/contribute-screen/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { FilterDto } from "@dzcode.io/api/dist/contribution/types"; -import { createAsyncThunk } from "@reduxjs/toolkit"; -import { fetchV2 } from "src/utils/fetch"; - -export const fetchContributions = createAsyncThunk( - "contributeScreen/fetchContributions", - async (filtersParam: FilterDto[]) => { - try { - const query: [string, string][] = []; - filtersParam.forEach((filter) => { - filter.options.forEach((option) => { - if (option.checked) query.push([filter.name, option.name]); - }); - }); - const { contributions, filters } = await fetchV2("api:Contributions", { - query, - }); - const checkedFilters: Array<{ - filterName: string; - optionName: string; - }> = []; - filtersParam.forEach((filter) => { - filter.options.forEach((option) => { - if (option.checked) { - checkedFilters.push({ - filterName: filter.name, - optionName: option.name, - }); - } - }); - }); - const newFilters = filters.map((filter) => ({ - ...filter, - options: filter.options.map((option) => ({ - ...option, - checked: checkedFilters.some( - ({ filterName, optionName }) => - filterName === filter.name && optionName === option.name, - ), - })), - })); - return { contributions, filters: newFilters }; - } catch (error: any) { - return error.message; - } - }, -); diff --git a/mobile/src/redux/actions/general/index.ts b/mobile/src/redux/actions/general/index.ts deleted file mode 100644 index ad4b6c07a..000000000 --- a/mobile/src/redux/actions/general/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; -import Debounce from "debounce"; -import { Appearance } from "react-native"; -import { AppDispatch, RootState } from "src/redux"; -import { getThemeFromSystem, setTheme } from "src/redux/reducers/general/slice"; - -export const init = createAsyncThunk< - any, - any, - { - dispatch: AppDispatch; - state: RootState; - } ->("general/init", (_, { getState, dispatch }) => { - const applyThemeDebounced: Appearance.AppearanceListener = Debounce(() => { - const theme = getThemeFromSystem(); - const currentTheme = getState().general.theme; - if (theme === currentTheme) return; - dispatch(setTheme(theme)); - }, 200); - Appearance.addChangeListener(applyThemeDebounced); -}); diff --git a/mobile/src/redux/actions/learn-screen/index.ts b/mobile/src/redux/actions/learn-screen/index.ts deleted file mode 100644 index 8c11cb802..000000000 --- a/mobile/src/redux/actions/learn-screen/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; -import { fetchV2 } from "src/utils/fetch"; - -export const fetchDocumentationList = createAsyncThunk("learnScreen/fetchDocuments", async () => { - try { - const { documentation } = await fetchV2("api:Documentation", {}); - return documentation; - } catch (error: any) { - return error.message; - } -}); - -export const fetchDocumentation = createAsyncThunk( - "learnScreen/fetchDocument", - async (slug: string) => { - try { - const { documentation } = await fetchV2("api:Documentation/:slug", { params: { slug } }); - return documentation; - } catch (error: any) { - return error.message; - } - }, -); diff --git a/mobile/src/redux/actions/projects-screen/index.ts b/mobile/src/redux/actions/projects-screen/index.ts deleted file mode 100644 index 0b4d5091d..000000000 --- a/mobile/src/redux/actions/projects-screen/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; -import { fetchV2 } from "src/utils/fetch"; -import { shuffleArray } from "src/utils/shuffle"; - -export const fetchProjects = createAsyncThunk("projectsScreen/fetchProjects", async () => { - try { - const { projects } = await fetchV2("api:Projects", {}); - return shuffleArray(projects); - } catch (error: any) { - return error.message; - } -}); diff --git a/mobile/src/redux/index.ts b/mobile/src/redux/index.ts deleted file mode 100644 index d3898fb3a..000000000 --- a/mobile/src/redux/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { configureStore } from "@reduxjs/toolkit"; - -import { reducer } from "./reducers"; - -export const store = configureStore({ - reducer, -}); - -export type RootState = ReturnType; -export type AppDispatch = typeof store.dispatch; diff --git a/mobile/src/redux/reducers/articles-screen/adapters/articles.ts b/mobile/src/redux/reducers/articles-screen/adapters/articles.ts deleted file mode 100644 index 055c19787..000000000 --- a/mobile/src/redux/reducers/articles-screen/adapters/articles.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; -import { createEntityAdapter } from "@reduxjs/toolkit"; - -type Article = - | Endpoints["api:Articles"]["response"]["articles"][number] - | Endpoints["api:Articles/:slug"]["response"]["article"]; - -export const articlesAdapter = createEntityAdapter
({ - selectId: (article) => article.slug, -}); diff --git a/mobile/src/redux/reducers/articles-screen/selectors/index.ts b/mobile/src/redux/reducers/articles-screen/selectors/index.ts deleted file mode 100644 index e45e90db9..000000000 --- a/mobile/src/redux/reducers/articles-screen/selectors/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { RootState } from "src/redux"; -import { articlesAdapter } from "src/redux/reducers/articles-screen/adapters/articles"; - -export const { selectAll: selectArticles } = articlesAdapter.getSelectors( - (state: RootState) => state.articlesScreen, -); diff --git a/mobile/src/redux/reducers/articles-screen/slice.ts b/mobile/src/redux/reducers/articles-screen/slice.ts deleted file mode 100644 index d5fa7347e..000000000 --- a/mobile/src/redux/reducers/articles-screen/slice.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { createSlice, PayloadAction } from "@reduxjs/toolkit"; -import { useSelector } from "react-redux"; -import { RootState } from "src/redux"; -import { fetchArticle, fetchArticles } from "src/redux/actions/articles-screen"; - -import { articlesAdapter } from "./adapters/articles"; -import { selectArticles } from "./selectors"; - -interface ArticlesScreenState { - status: "idle" | "loading" | "error"; - error: string | null; -} - -const initialState = articlesAdapter.getInitialState({ - status: "idle", - error: null, -}); - -const articlesScreenSlice = createSlice({ - name: "articlesScreen", - initialState, - reducers: {}, - extraReducers(builder) { - builder - .addCase(fetchArticles.pending, (state) => { - state.status = "loading"; - }) - .addCase(fetchArticles.fulfilled, (state, action) => { - state.status = "idle"; - state.error = null; - articlesAdapter.setAll(state, action.payload); - }) - .addCase(fetchArticles.rejected, (state, action: PayloadAction) => { - state.status = "error"; - state.error = action.payload.message; - }) - .addCase(fetchArticle.pending, (state) => { - state.status = "loading"; - }) - .addCase(fetchArticle.fulfilled, (state, action) => { - state.status = "idle"; - state.error = null; - articlesAdapter.upsertOne(state, action.payload); - }) - .addCase(fetchArticle.rejected, (state, action: PayloadAction) => { - state.status = "error"; - state.error = action.payload.message; - }); - }, -}); - -export const useArticlesSliceSelector = () => ({ - ...useSelector((state: RootState) => state.articlesScreen), - articles: useSelector(selectArticles), -}); - -export default articlesScreenSlice; diff --git a/mobile/src/redux/reducers/contribute-screen/adapters/contributions.ts b/mobile/src/redux/reducers/contribute-screen/adapters/contributions.ts deleted file mode 100644 index ea83a328f..000000000 --- a/mobile/src/redux/reducers/contribute-screen/adapters/contributions.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Model } from "@dzcode.io/models/dist/_base"; -import { ContributionEntity } from "@dzcode.io/models/dist/contribution"; -import { createEntityAdapter } from "@reduxjs/toolkit"; - -type Contribution = Model; - -export const contributionsAdapter = createEntityAdapter({ - selectId: (contribution) => contribution.id, -}); diff --git a/mobile/src/redux/reducers/contribute-screen/adapters/filters.ts b/mobile/src/redux/reducers/contribute-screen/adapters/filters.ts deleted file mode 100644 index 6429f7b0d..000000000 --- a/mobile/src/redux/reducers/contribute-screen/adapters/filters.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { FilterDto } from "@dzcode.io/api/dist/contribution/types"; -import { createEntityAdapter } from "@reduxjs/toolkit"; - -export const filtersAdapter = createEntityAdapter({ - selectId: (filter) => filter.name, -}); diff --git a/mobile/src/redux/reducers/contribute-screen/selectors/index.ts b/mobile/src/redux/reducers/contribute-screen/selectors/index.ts deleted file mode 100644 index e4aac62ed..000000000 --- a/mobile/src/redux/reducers/contribute-screen/selectors/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { RootState } from "src/redux"; -import { contributionsAdapter } from "src/redux/reducers/contribute-screen/adapters/contributions"; -import { filtersAdapter } from "src/redux/reducers/contribute-screen/adapters/filters"; - -export const { selectAll: selectContributions } = contributionsAdapter.getSelectors( - (state: RootState) => state.contributeScreen.contributions, -); - -export const { selectAll: selectFilters } = filtersAdapter.getSelectors( - (state: RootState) => state.contributeScreen.filters, -); diff --git a/mobile/src/redux/reducers/contribute-screen/slice.ts b/mobile/src/redux/reducers/contribute-screen/slice.ts deleted file mode 100644 index 0e5955749..000000000 --- a/mobile/src/redux/reducers/contribute-screen/slice.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { FilterDto } from "@dzcode.io/api/dist/contribution/types"; -import { Model } from "@dzcode.io/models/dist/_base"; -import { ContributionEntity } from "@dzcode.io/models/dist/contribution"; -import { createSlice, EntityState, PayloadAction } from "@reduxjs/toolkit"; -import { useSelector } from "react-redux"; -import { RootState } from "src/redux"; -import { fetchContributions } from "src/redux/actions/contribute-screen"; - -import { contributionsAdapter } from "./adapters/contributions"; -import { filtersAdapter } from "./adapters/filters"; -import { selectContributions, selectFilters } from "./selectors"; - -interface ContributeScreenState { - contributions: EntityState>; - filters: EntityState; - status: "idle" | "loading" | "error"; - error: string | null; -} - -const initialState: ContributeScreenState = { - contributions: contributionsAdapter.getInitialState(), - filters: filtersAdapter.getInitialState(), - status: "idle", - error: null, -}; - -const contributeScreenSlice = createSlice({ - name: "contributeScreen", - initialState: initialState, - reducers: { - updateFilterValue: ( - state, - action: PayloadAction<{ filterName: string; optionName: string }>, - ) => { - const { filterName, optionName } = action.payload; - const filter = state.filters.entities[filterName]; - if (!filter) return; - const option = filter.options.find((o) => o.name === optionName); - if (!option) return; - option.checked = !option.checked; - }, - }, - extraReducers(builder) { - builder - .addCase(fetchContributions.pending, (state) => { - state.status = "loading"; - }) - .addCase(fetchContributions.fulfilled, (state, action) => { - state.status = "idle"; - state.error = null; - contributionsAdapter.setAll(state.contributions, action.payload.contributions); - filtersAdapter.setAll(state.filters, action.payload.filters); - }) - .addCase(fetchContributions.rejected, (state, action: PayloadAction) => { - state.status = "error"; - state.error = action.payload.message; - }); - }, -}); - -export const { updateFilterValue } = contributeScreenSlice.actions; - -export const useContributeSliceSelector = () => ({ - ...useSelector((state: RootState) => state.contributeScreen), - contributions: useSelector(selectContributions), - filters: useSelector(selectFilters), -}); - -export default contributeScreenSlice; diff --git a/mobile/src/redux/reducers/faq-screen/slice.ts b/mobile/src/redux/reducers/faq-screen/slice.ts deleted file mode 100644 index 490dfdd65..000000000 --- a/mobile/src/redux/reducers/faq-screen/slice.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { createSlice } from "@reduxjs/toolkit"; -import { useSelector } from "react-redux"; -import { RootState } from "src/redux"; - -export type FAQData = Array<{ - title: string; - questions: Array<{ - question: string; - answer: string; - }>; -}>; - -export const faqData: FAQData = [ - { - title: "General", - questions: [ - { - question: "What exactly is DzCode i/o ?", - answer: `An open-source online community of algerian developers, no organization or any political party is involved, only us dz developers.`, - }, - { - question: "What are the Goals of DzCode i/o ?", - answer: ` -- Share our experiences (in form of [Articles](/Articles)), there are many algerian developers that accumulated lots experiences, dzcode.io gives them the chance to share it with the right audience. -- Guide new developers to build their career (with detailed [documentation](/Learn)), and understand the software market, instead of wasting their time on other useless resources. -- Fix some common algerian software problems, in form of ready to use open-source [softwares](/Projects) (packages, libraries ...etc).`, - }, - { - question: "What benefit will i get from it ?", - answer: `There are couple of benefits, to name few: - -- You will meet other algerian developers, experienced and juniors, where you can grow your network! -- You'll get to experience a professional environment, which is completely different than the one you used to in school. -- Your contribution will be shown on your Github profile, and that is a big plus in your professional career! -`, - }, - { - question: "dzcode, dzcode.io or DzCode i/o ?", - answer: `You may get confused with the different terms, so here's the official breakdown: - -- **DzCode i/o** (with capital C) is the official name of the community. -- **dzcode.io** is the website of the DzCode i/o, this has been voted for [here](https://www.facebook.com/groups/dzdevs/permalink/3052880478141052/). -- **dzcode** is a short name, not official, but it's usually used to refer DzCode i/o. -`, - }, - ], - }, - { - title: "Participation", - questions: [ - { - question: "How to join DzCode i/o ?", - answer: `We're most active in slack, it's highly recommended to [join us there](https://join.slack.com/t/dzcode/shared_invite/zt-ek9kscb7-m8z_~cBjX79l~uchuABPFQ).`, - }, - { - question: "I want to code, where should I start ?", - answer: `Go to [/Contribute](/Contribute) page, you will see list projects with their open tasks, pick whatever you like and start coding 🔥. - -**Note** : Please make sure to inform the project maintainer to reserve the task for you, you can do that by commenting on the issue ticket.`, - }, - { - question: "I like the idea, what are the different ways i can contribute to DzCode i/o ?", - answer: `Apart from checking out the [/Contribute](/Contribute) page, you can also contribute to DzCode i/o by: - -- Adding your open-source projects to dzcode.io website, you can do that [here](/Learn/About_dzcode_io/Add_Your_Project_To_dzcode_io). -- Writing about your experience in form of articles, it's as easy as following the steps [here](/Learn/About_dzcode_io/Add_Your_Article_To_dzcode_io). -`, - }, - ], - }, - { - title: "Articles", - questions: [ - { - question: "How to write an article in dzcode.io", - answer: `See this [tutorial](/Learn/About_dzcode_io/Add_Your_Article_To_dzcode_io).`, - }, - { - question: "The Articles should they be in English ?", - answer: - "Yes, to reach a wide range of audience we will add a feature to allow article localization and multiple language articles in the future.", - }, - { - question: "Can I write about anything ?", - answer: "As long as its IT related yes you can write about anything.", - }, - ], - }, - { - title: "Projects", - questions: [ - { - question: "How to add my open-source project to dzcode.io", - answer: `See this [tutorial](/Learn/About_dzcode_io/Add_Your_Project_To_dzcode_io).`, - }, - { - question: "What makes my project eligible to be added to dzcode.io", - answer: "It has to solve an Algerian problem, or, to be written by an Algerian Developer.", - }, - { - question: "Why should i add my project to dzcode.io ?", - answer: ` -- Your project will potentially get noticed by more algerian developers. -- You will get potential contribution from other DZ developers, and eventually better shape your piece of software. -`, - }, - ], - }, -]; - -interface FAQState { - data: FAQData; -} - -const initialState: FAQState = { - data: faqData, -}; - -const faqScreenSlice = createSlice({ - name: "faqScreen", - initialState, - reducers: {}, -}); - -export const useFaqSliceSelector = () => ({ - ...useSelector((state: RootState) => state.faqScreen), -}); - -export default faqScreenSlice; diff --git a/mobile/src/redux/reducers/general/slice.ts b/mobile/src/redux/reducers/general/slice.ts deleted file mode 100644 index 3ee85de0a..000000000 --- a/mobile/src/redux/reducers/general/slice.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { createSlice } from "@reduxjs/toolkit"; -import { Appearance } from "react-native"; -import { useSelector } from "react-redux"; -import { RootState } from "src/redux"; - -interface GeneralState { - theme: "dark" | "light"; -} - -export const getThemeFromSystem = ( - colorScheme = Appearance.getColorScheme(), -): GeneralState["theme"] => { - switch (colorScheme) { - case "dark": - return "dark"; - case "light": - default: - return "light"; - } -}; - -const initialState: GeneralState = { - theme: getThemeFromSystem(), -}; - -const generalSlice = createSlice({ - name: "general", - initialState, - reducers: { - setTheme: (state, action) => { - state.theme = action.payload; - }, - }, -}); - -export const { setTheme } = generalSlice.actions; - -export const useGeneralSliceSelector = () => ({ - ...useSelector((state: RootState) => state.general), -}); - -export default generalSlice; diff --git a/mobile/src/redux/reducers/index.ts b/mobile/src/redux/reducers/index.ts deleted file mode 100644 index c8104b557..000000000 --- a/mobile/src/redux/reducers/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import articlesScreenSlice from "./articles-screen/slice"; -import contributeScreenSlice from "./contribute-screen/slice"; -import faqScreenSlice from "./faq-screen/slice"; -import generalSlice from "./general/slice"; -import learnScreenSlice from "./learn-screen/slice"; -import projectsScreenSlice from "./projects-screen/slice"; - -export const reducer = { - articlesScreen: articlesScreenSlice.reducer, - contributeScreen: contributeScreenSlice.reducer, - faqScreen: faqScreenSlice.reducer, - learnScreen: learnScreenSlice.reducer, - projectsScreen: projectsScreenSlice.reducer, - general: generalSlice.reducer, -}; diff --git a/mobile/src/redux/reducers/learn-screen/adapters/documents.ts b/mobile/src/redux/reducers/learn-screen/adapters/documents.ts deleted file mode 100644 index 6751534f0..000000000 --- a/mobile/src/redux/reducers/learn-screen/adapters/documents.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; -import { createEntityAdapter } from "@reduxjs/toolkit"; - -type Document = - | Endpoints["api:Documentation"]["response"]["documentation"][number] - | Endpoints["api:Documentation/:slug"]["response"]["documentation"]; - -export const documentsAdapter = createEntityAdapter({ - selectId: (document) => document.slug, -}); diff --git a/mobile/src/redux/reducers/learn-screen/selectors/index.ts b/mobile/src/redux/reducers/learn-screen/selectors/index.ts deleted file mode 100644 index ce8528598..000000000 --- a/mobile/src/redux/reducers/learn-screen/selectors/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { RootState } from "src/redux"; -import { documentsAdapter } from "src/redux/reducers/learn-screen/adapters/documents"; - -export const { selectAll: selectDocuments } = documentsAdapter.getSelectors( - (state: RootState) => state.learnScreen, -); diff --git a/mobile/src/redux/reducers/learn-screen/slice.ts b/mobile/src/redux/reducers/learn-screen/slice.ts deleted file mode 100644 index 6796ea8a6..000000000 --- a/mobile/src/redux/reducers/learn-screen/slice.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { createSlice, PayloadAction } from "@reduxjs/toolkit"; -import { useSelector } from "react-redux"; -import { RootState } from "src/redux"; -import { fetchDocumentation, fetchDocumentationList } from "src/redux/actions/learn-screen"; - -import { documentsAdapter } from "./adapters/documents"; -import { selectDocuments } from "./selectors"; - -interface LearnScreenState { - status: "idle" | "loading" | "error"; - error: string | null; -} - -const initialState = documentsAdapter.getInitialState({ - status: "idle", - error: null, -}); - -const learnScreenSlice = createSlice({ - name: "learnScreen", - initialState, - reducers: {}, - extraReducers(builder) { - builder - .addCase(fetchDocumentationList.pending, (state) => { - state.status = "loading"; - }) - .addCase(fetchDocumentationList.fulfilled, (state, action) => { - state.status = "idle"; - state.error = null; - documentsAdapter.setAll(state, action.payload); - }) - .addCase(fetchDocumentationList.rejected, (state, action: PayloadAction) => { - state.status = "error"; - state.error = action.payload.message; - }) - .addCase(fetchDocumentation.pending, (state) => { - state.status = "loading"; - }) - .addCase(fetchDocumentation.fulfilled, (state, action) => { - state.status = "idle"; - state.error = null; - documentsAdapter.setOne(state, action.payload); - }) - .addCase(fetchDocumentation.rejected, (state, action: PayloadAction) => { - state.status = "error"; - state.error = action.payload.message; - }); - }, -}); - -export const useLearnSliceSelector = () => ({ - ...useSelector((state: RootState) => state.learnScreen), - documents: useSelector(selectDocuments), -}); - -export default learnScreenSlice; diff --git a/mobile/src/redux/reducers/projects-screen/adapters/projects.ts b/mobile/src/redux/reducers/projects-screen/adapters/projects.ts deleted file mode 100644 index dd928be27..000000000 --- a/mobile/src/redux/reducers/projects-screen/adapters/projects.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Model } from "@dzcode.io/models/dist/_base"; -import { ProjectEntity } from "@dzcode.io/models/dist/project"; -import { RepositoryEntity } from "@dzcode.io/models/dist/repository"; -import { createEntityAdapter } from "@reduxjs/toolkit"; - -type Project = Model & { - repositories: Model[]; -}; - -export const projectsAdapter = createEntityAdapter({ - selectId: (project) => project.slug, -}); diff --git a/mobile/src/redux/reducers/projects-screen/selectors/index.ts b/mobile/src/redux/reducers/projects-screen/selectors/index.ts deleted file mode 100644 index a71c77822..000000000 --- a/mobile/src/redux/reducers/projects-screen/selectors/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { RootState } from "src/redux"; -import { projectsAdapter } from "src/redux/reducers/projects-screen/adapters/projects"; - -export const { selectAll: selectProjects } = projectsAdapter.getSelectors( - (state: RootState) => state.projectsScreen, -); diff --git a/mobile/src/redux/reducers/projects-screen/slice.ts b/mobile/src/redux/reducers/projects-screen/slice.ts deleted file mode 100644 index c7a491253..000000000 --- a/mobile/src/redux/reducers/projects-screen/slice.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { createSlice, PayloadAction } from "@reduxjs/toolkit"; -import { useSelector } from "react-redux"; -import { RootState } from "src/redux"; -import { fetchProjects } from "src/redux/actions/projects-screen"; - -import { projectsAdapter } from "./adapters/projects"; -import { selectProjects } from "./selectors"; - -interface ProjectsScreenState { - status: "idle" | "loading" | "error"; - error: string | null; -} - -const initialState = projectsAdapter.getInitialState({ - status: "idle", - error: null, -}); - -const projectsScreenSlice = createSlice({ - name: "projectsScreen", - initialState, - reducers: {}, - extraReducers(builder) { - builder - .addCase(fetchProjects.pending, (state) => { - state.status = "loading"; - }) - .addCase(fetchProjects.fulfilled, (state, action) => { - state.status = "idle"; - state.error = null; - projectsAdapter.setAll(state, action.payload); - }) - .addCase(fetchProjects.rejected, (state, action: PayloadAction) => { - state.status = "error"; - state.error = action.payload.message; - }); - }, -}); - -export const useProjectsSliceSelector = () => ({ - ...useSelector((state: RootState) => state.projectsScreen), - projects: useSelector(selectProjects), -}); - -export default projectsScreenSlice; diff --git a/mobile/src/screens/articles/article-details/index.tsx b/mobile/src/screens/articles/article-details/index.tsx deleted file mode 100644 index 82459a237..000000000 --- a/mobile/src/screens/articles/article-details/index.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import { ArticleEntity } from "@dzcode.io/models/dist/article"; -import { useNavigation } from "@dzcode.io/ui-mobile/dist/_hooks/use-navigation"; -import type { RouteParam } from "@dzcode.io/ui-mobile/dist/_types/route-param"; -import { ErrorBoundary } from "@dzcode.io/ui-mobile/dist/error-boundary"; -import { DZCodeLoading } from "@dzcode.io/ui-mobile/dist/loading"; -import { Markdown } from "@dzcode.io/ui-mobile/dist/markdown"; -import { Text } from "@dzcode.io/ui-mobile/dist/text/text"; -import { TryAgain } from "@dzcode.io/ui-mobile/dist/try-again"; -import { isLoaded } from "@dzcode.io/utils/dist/loadable"; -import React, { FC, useEffect } from "react"; -import { Image, SafeAreaView, ScrollView, TouchableOpacity, View } from "react-native"; -import { useDispatch } from "react-redux"; -import { AppDispatch } from "src/redux"; -import { fetchArticle } from "src/redux/actions/articles-screen"; -import { useArticlesSliceSelector } from "src/redux/reducers/articles-screen/slice"; -import { globalStyles } from "src/styles/global"; -import { openLink } from "src/utils/link"; - -import { articleDetailsStyles } from "./styles"; - -interface ArticleDetailsScreenProps { - route: RouteParam<"article-details", RouteParams>; -} - -interface RouteParams { - article: ArticleEntity; -} - -export const ArticleDetailsScreen: FC = ({ - route, -}: ArticleDetailsScreenProps) => { - const { articles, status } = useArticlesSliceSelector(); - const loadedArticles = isLoaded(articles); - const currentArticle = ( - loadedArticles?.filter((article) => (article as ArticleEntity).content) as ArticleEntity[] - ).find((article) => article.slug === route.params.article.slug); - const dispatch = useDispatch(); - const navigation = useNavigation(); - - useEffect(() => { - dispatch(fetchArticle(route.params.article.slug)); - }, []); - - return ( - - - {status === "loading" ? ( - - - - ) : currentArticle ? ( - - - {route.params.article.title} - {currentArticle.description} - openLink(url, navigation)} - /> - {currentArticle.authors.length > 0 && - currentArticle.authors.find((a) => !a.id.includes("undefined")) && ( - <> - This article is written by - - {currentArticle.authors?.map((author) => ( - openLink(author.profileUrl)}> - - - ))} - - - )} - {currentArticle.contributors.length > 0 && ( - <> - With the help of - - {currentArticle.contributors?.map((contributor) => ( - openLink(contributor.profileUrl)} - > - - - ))} - - - )} - - ) : ( - dispatch(fetchArticle(route.params.article.slug))} - /> - )} - - - ); -}; diff --git a/mobile/src/screens/articles/article-details/styles.ts b/mobile/src/screens/articles/article-details/styles.ts deleted file mode 100644 index 5653ac671..000000000 --- a/mobile/src/screens/articles/article-details/styles.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { - LARGE_LOGO_HEIGHT, - LARGE_MARGIN_SIZE, - MEDIUM_MARGIN_SIZE, - MEDIUM_TEXT_SIZE, - SMALL_MARGIN_SIZE, -} from "@dzcode.io/ui-mobile/dist/_utils/constants"; -import { StyleSheet } from "react-native"; - -export const articleDetailsStyles = StyleSheet.create({ - image: { - width: "100%", - height: LARGE_LOGO_HEIGHT, - }, - mdBody: { - marginHorizontal: LARGE_MARGIN_SIZE, - }, - descriptionText: { - marginHorizontal: MEDIUM_MARGIN_SIZE, - }, - authorsText: { - fontWeight: "bold", - fontSize: MEDIUM_TEXT_SIZE, - marginHorizontal: MEDIUM_MARGIN_SIZE, - }, - authorAvatars: { - marginHorizontal: MEDIUM_MARGIN_SIZE, - flexDirection: "row", - alignItems: "center", - }, - avatar: { - marginLeft: SMALL_MARGIN_SIZE, - width: 50, - height: 50, - }, -}); diff --git a/mobile/src/screens/articles/articles-list/index.tsx b/mobile/src/screens/articles/articles-list/index.tsx deleted file mode 100644 index 9d8f133b3..000000000 --- a/mobile/src/screens/articles/articles-list/index.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { useNavigation } from "@dzcode.io/ui-mobile/dist/_hooks/use-navigation"; -import { Button } from "@dzcode.io/ui-mobile/dist/button"; -import { Divider } from "@dzcode.io/ui-mobile/dist/divider"; -import { ErrorBoundary } from "@dzcode.io/ui-mobile/dist/error-boundary"; -import { DZCodeLoading } from "@dzcode.io/ui-mobile/dist/loading"; -import { TryAgain } from "@dzcode.io/ui-mobile/dist/try-again"; -import React, { FC, useEffect } from "react"; -import { FlatList, SafeAreaView, View } from "react-native"; -import { useDispatch } from "react-redux"; -import { AppDispatch } from "src/redux"; -import { fetchArticles } from "src/redux/actions/articles-screen"; -import { useArticlesSliceSelector } from "src/redux/reducers/articles-screen/slice"; -import { globalStyles } from "src/styles/global"; - -import { articlesListStyles } from "./styles"; - -export const ArticlesListScreen: FC = () => { - const { articles, status } = useArticlesSliceSelector(); - - const navigation = useNavigation(); - - const dispatch = useDispatch(); - - useEffect(() => { - dispatch(fetchArticles()); - }, []); - - return ( - - - {status === "error" ? ( - dispatch(fetchArticles())} - /> - ) : articles ? ( - dispatch(fetchArticles())} - refreshing={status === "loading"} - ItemSeparatorComponent={() => } - keyExtractor={(item, index) => `item-${index}`} - renderItem={({ item }) => ( - - - - )} - /> - ) : ( - - - - )} - - - ); -}; diff --git a/mobile/src/screens/articles/articles-list/styles.ts b/mobile/src/screens/articles/articles-list/styles.ts deleted file mode 100644 index e0713d394..000000000 --- a/mobile/src/screens/articles/articles-list/styles.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SMALL_LOGO_HEIGHT, SMALL_PADDING_SIZE } from "@dzcode.io/ui-mobile/dist/_utils/constants"; -import { StyleSheet } from "react-native"; - -export const articlesListStyles = StyleSheet.create({ - button: { - height: SMALL_LOGO_HEIGHT, - paddingVertical: SMALL_PADDING_SIZE, - justifyContent: "center", - alignSelf: "flex-start", - }, -}); diff --git a/mobile/src/screens/articles/navigation.tsx b/mobile/src/screens/articles/navigation.tsx deleted file mode 100644 index 80265ba12..000000000 --- a/mobile/src/screens/articles/navigation.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import type { Route } from "@dzcode.io/ui-mobile/dist/_types/route"; -import { ErrorBoundary } from "@dzcode.io/ui-mobile/dist/error-boundary"; -import { StackNav } from "@dzcode.io/ui-mobile/dist/navigation/stack-nav"; -import React, { FC } from "react"; - -import { ArticleDetailsScreen } from "./article-details"; -import { ArticlesListScreen } from "./articles-list"; - -const routes: Route[] = [ - { - name: "articles-list", - component: ArticlesListScreen, - }, - { - name: "article-details", - component: ArticleDetailsScreen, - }, -]; - -export const Navigation: FC = () => { - return ( - - - - ); -}; diff --git a/mobile/src/screens/contribute/index.tsx b/mobile/src/screens/contribute/index.tsx deleted file mode 100644 index 73d663af1..000000000 --- a/mobile/src/screens/contribute/index.tsx +++ /dev/null @@ -1,124 +0,0 @@ -import { BottomSheet } from "@dzcode.io/ui-mobile/dist/bottom-sheet/bottom-sheet"; -import { BottomSheetScrollView } from "@dzcode.io/ui-mobile/dist/bottom-sheet/bottom-sheet-scroll-view"; -import { ContributeCard } from "@dzcode.io/ui-mobile/dist/card/contribute-card"; -import { ErrorBoundary } from "@dzcode.io/ui-mobile/dist/error-boundary"; -import { Filters } from "@dzcode.io/ui-mobile/dist/filter"; -import { DZCodeLoading } from "@dzcode.io/ui-mobile/dist/loading"; -import { Text } from "@dzcode.io/ui-mobile/dist/text/text"; -import { TryAgain } from "@dzcode.io/ui-mobile/dist/try-again"; -import React, { FC, useEffect, useState } from "react"; -import { FlatList, Image, Linking, SafeAreaView, View } from "react-native"; -import { useDispatch } from "react-redux"; -import { AppDispatch } from "src/redux"; -import { fetchContributions } from "src/redux/actions/contribute-screen"; -import { - updateFilterValue, - useContributeSliceSelector, -} from "src/redux/reducers/contribute-screen/slice"; -import { globalStyles } from "src/styles/global"; - -import { contributeStyles } from "./styles"; - -export const ContributeScreen: FC = () => { - const { contributions, filters, status } = useContributeSliceSelector(); - const [update, setUpdate] = useState(false); - - const dispatch = useDispatch(); - useEffect(() => { - dispatch(fetchContributions(filters)); - }, []); - - useEffect(() => { - if (update) { - dispatch(fetchContributions(filters)); - setUpdate(false); - } - }, [update]); - - return ( - - - {status === "error" ? ( - dispatch(fetchContributions(filters))} - /> - ) : contributions ? ( - // Cards - contributions.length > 0 ? ( - { - dispatch(fetchContributions(filters)); - }} - refreshing={status === "loading"} - keyExtractor={(item, index) => `item-${index}`} - renderItem={({ item }) => ( - { - setUpdate(false); - const filterName = item.labels.includes(optionName) ? "labels" : "languages"; - dispatch( - updateFilterValue({ - filterName, - optionName, - }), - ); - setUpdate(true); - }} - onPress={() => { - try { - Linking.openURL(item.url); - } catch { - alert("Can't open browser"); - } - }} - /> - )} - /> - ) : ( - - - There is no contribution - - ) - ) : ( - // Loading indicator - - - - )} - {/* Filters */} - - {filters ? ( - - { - setUpdate(false); - dispatch( - updateFilterValue({ - filterName, - optionName, - }), - ); - setUpdate(true); - }} - /> - - ) : ( - - - - )} - - - - ); -}; diff --git a/mobile/src/screens/contribute/styles.ts b/mobile/src/screens/contribute/styles.ts deleted file mode 100644 index e235d9c9a..000000000 --- a/mobile/src/screens/contribute/styles.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { - MEDIUM_LOGO_HEIGHT, - MEDIUM_LOGO_WIDTH, - MEDIUM_MARGIN_SIZE, - MEDIUM_TEXT_SIZE, -} from "@dzcode.io/ui-mobile/dist/_utils/constants"; -import { StyleSheet } from "react-native"; - -export const contributeStyles = StyleSheet.create({ - dzcodeLoading: { - position: "absolute", - }, - emptyStateLogo: { - width: MEDIUM_LOGO_WIDTH, - height: MEDIUM_LOGO_HEIGHT, - }, - emptyStateText: { - marginTop: MEDIUM_MARGIN_SIZE, - marginBottom: MEDIUM_MARGIN_SIZE, - textAlign: "center", - fontSize: MEDIUM_TEXT_SIZE, - }, - listView: { - marginVertical: MEDIUM_MARGIN_SIZE, - }, -}); diff --git a/mobile/src/screens/faq/index.tsx b/mobile/src/screens/faq/index.tsx deleted file mode 100644 index 46fc60c19..000000000 --- a/mobile/src/screens/faq/index.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { useNavigation } from "@dzcode.io/ui-mobile/dist/_hooks/use-navigation"; -import { ErrorBoundary } from "@dzcode.io/ui-mobile/dist/error-boundary"; -import { List } from "@dzcode.io/ui-mobile/dist/list"; -import { Markdown } from "@dzcode.io/ui-mobile/dist/markdown"; -import { Text } from "@dzcode.io/ui-mobile/dist/text/text"; -import React, { FC } from "react"; -import { SafeAreaView, ScrollView, View } from "react-native"; -import { useFaqSliceSelector } from "src/redux/reducers/faq-screen/slice"; -import { globalStyles } from "src/styles/global"; -import { openLink } from "src/utils/link"; - -import { faqStyles } from "./styles"; - -export const FAQScreen: FC = () => { - const navigation = useNavigation(); - const { data } = useFaqSliceSelector(); - - return ( - - - - {data.map(({ title, questions }, index) => ( - - {title} - - {questions.map(({ question, answer }, index) => ( - - openLink(url, navigation)} /> - - ))} - - - ))} - - - - ); -}; diff --git a/mobile/src/screens/faq/styles.ts b/mobile/src/screens/faq/styles.ts deleted file mode 100644 index a8ae2f498..000000000 --- a/mobile/src/screens/faq/styles.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { MEDIUM_PADDING_SIZE, MEDIUM_TEXT_SIZE } from "@dzcode.io/ui-mobile/dist/_utils/constants"; -import { Colors } from "@dzcode.io/ui-mobile/dist/theme/style/color"; -import { StyleSheet } from "react-native"; - -export const faqStyles = StyleSheet.create({ - title: { - textAlign: "center", - fontSize: MEDIUM_TEXT_SIZE, - color: Colors.grey, - }, - description: { - padding: MEDIUM_PADDING_SIZE, - }, -}); diff --git a/mobile/src/screens/learn/document-details/index.tsx b/mobile/src/screens/learn/document-details/index.tsx deleted file mode 100644 index 60a95e1fb..000000000 --- a/mobile/src/screens/learn/document-details/index.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { DocumentationEntity } from "@dzcode.io/models/dist/documentation"; -import type { RouteParam } from "@dzcode.io/ui-mobile/dist/_types/route-param"; -import { ErrorBoundary } from "@dzcode.io/ui-mobile/dist/error-boundary"; -import { DZCodeLoading } from "@dzcode.io/ui-mobile/dist/loading"; -import { Markdown } from "@dzcode.io/ui-mobile/dist/markdown"; -import { Text } from "@dzcode.io/ui-mobile/dist/text/text"; -import { TryAgain } from "@dzcode.io/ui-mobile/dist/try-again"; -import { isLoaded } from "@dzcode.io/utils/dist/loadable"; -import React, { FC, useEffect } from "react"; -import { Image, SafeAreaView, ScrollView, View } from "react-native"; -import { useDispatch } from "react-redux"; -import { AppDispatch } from "src/redux"; -import { fetchDocumentation } from "src/redux/actions/learn-screen"; -import { useLearnSliceSelector } from "src/redux/reducers/learn-screen/slice"; -import { globalStyles } from "src/styles/global"; -import { openLink } from "src/utils/link"; - -import { documentDetailsStyles } from "./styles"; - -interface DocumentDetailsScreenProps { - route: RouteParam<"DocumentDetails", RouteParams>; -} - -interface RouteParams { - document: DocumentationEntity; -} - -export const DocumentDetailsScreen: FC = ({ - route, -}: DocumentDetailsScreenProps) => { - const { documents, status } = useLearnSliceSelector(); - const loadedDocuments = isLoaded(documents); - const currentDocument = ( - loadedDocuments?.filter( - (document) => (document as DocumentationEntity).content, - ) as DocumentationEntity[] - ).find((document) => document.slug === route.params.document.slug); - const dispatch = useDispatch(); - - useEffect(() => { - dispatch(fetchDocumentation(route.params.document.slug)); - }, []); - - return ( - - - {status === "loading" ? ( - - - - ) : currentDocument ? ( - - - {route.params.document.title} - {currentDocument.description} - openLink(url)} /> - - Authors: {currentDocument.authors?.map(({ name }) => name).join(", ")} - - - ) : ( - dispatch(fetchDocumentation(route.params.document.slug))} - /> - )} - - - ); -}; diff --git a/mobile/src/screens/learn/document-details/styles.ts b/mobile/src/screens/learn/document-details/styles.ts deleted file mode 100644 index dfb261ec2..000000000 --- a/mobile/src/screens/learn/document-details/styles.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { - LARGE_LOGO_HEIGHT, - LARGE_MARGIN_SIZE, - MEDIUM_MARGIN_SIZE, - MEDIUM_TEXT_SIZE, -} from "@dzcode.io/ui-mobile/dist/_utils/constants"; -import { StyleSheet } from "react-native"; - -export const documentDetailsStyles = StyleSheet.create({ - image: { - width: "100%", - height: LARGE_LOGO_HEIGHT, - }, - mdBody: { - marginHorizontal: LARGE_MARGIN_SIZE, - }, - descriptionText: { - marginHorizontal: MEDIUM_MARGIN_SIZE, - }, - authorsText: { - fontWeight: "bold", - fontSize: MEDIUM_TEXT_SIZE, - marginHorizontal: MEDIUM_MARGIN_SIZE, - }, -}); diff --git a/mobile/src/screens/learn/documents-list/index.tsx b/mobile/src/screens/learn/documents-list/index.tsx deleted file mode 100644 index ac046999c..000000000 --- a/mobile/src/screens/learn/documents-list/index.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { useNavigation } from "@dzcode.io/ui-mobile/dist/_hooks/use-navigation"; -import { Button } from "@dzcode.io/ui-mobile/dist/button"; -import { Divider } from "@dzcode.io/ui-mobile/dist/divider"; -import { ErrorBoundary } from "@dzcode.io/ui-mobile/dist/error-boundary"; -import { DZCodeLoading } from "@dzcode.io/ui-mobile/dist/loading"; -import { TryAgain } from "@dzcode.io/ui-mobile/dist/try-again"; -import React, { FC, useEffect } from "react"; -import { FlatList, SafeAreaView, View } from "react-native"; -import { useDispatch } from "react-redux"; -import { AppDispatch } from "src/redux"; -import { fetchDocumentationList } from "src/redux/actions/learn-screen"; -import { useLearnSliceSelector } from "src/redux/reducers/learn-screen/slice"; -import { globalStyles } from "src/styles/global"; - -import { documentsListStyles } from "./styles"; - -export const DocumentsListScreen: FC = () => { - const { documents, status } = useLearnSliceSelector(); - - const navigation = useNavigation(); - - const dispatch = useDispatch(); - - useEffect(() => { - dispatch(fetchDocumentationList()); - }, []); - - return ( - - - {status === "error" ? ( - dispatch(fetchDocumentationList())} - /> - ) : documents ? ( - dispatch(fetchDocumentationList())} - refreshing={status === "loading"} - ItemSeparatorComponent={() => } - keyExtractor={(_, index) => `item-${index}`} - renderItem={({ item }) => ( - - )} - /> - ) : ( - - - - )} - - - ); -}; diff --git a/mobile/src/screens/learn/documents-list/styles.ts b/mobile/src/screens/learn/documents-list/styles.ts deleted file mode 100644 index f5ff72a8d..000000000 --- a/mobile/src/screens/learn/documents-list/styles.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SMALL_LOGO_HEIGHT, SMALL_PADDING_SIZE } from "@dzcode.io/ui-mobile/dist/_utils/constants"; -import { StyleSheet } from "react-native"; - -export const documentsListStyles = StyleSheet.create({ - button: { - height: SMALL_LOGO_HEIGHT, - paddingVertical: SMALL_PADDING_SIZE, - justifyContent: "center", - alignSelf: "flex-start", - }, -}); diff --git a/mobile/src/screens/learn/navigation.tsx b/mobile/src/screens/learn/navigation.tsx deleted file mode 100644 index 2ab69f7e4..000000000 --- a/mobile/src/screens/learn/navigation.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import type { Route } from "@dzcode.io/ui-mobile/dist/_types/route"; -import { ErrorBoundary } from "@dzcode.io/ui-mobile/dist/error-boundary"; -import { StackNav } from "@dzcode.io/ui-mobile/dist/navigation/stack-nav"; -import React, { FC } from "react"; - -import { DocumentDetailsScreen } from "./document-details"; -import { DocumentsListScreen } from "./documents-list"; - -const routes: Route[] = [ - { - name: "documents-list", - component: DocumentsListScreen, - }, - { - name: "document-details", - component: DocumentDetailsScreen, - }, -]; - -export const Navigation: FC = () => { - return ( - - - - ); -}; diff --git a/mobile/src/screens/navigation.tsx b/mobile/src/screens/navigation.tsx deleted file mode 100644 index e78c6fba4..000000000 --- a/mobile/src/screens/navigation.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import type { Route } from "@dzcode.io/ui-mobile/dist/_types/route"; -import { AppBar } from "@dzcode.io/ui-mobile/dist/app-bar"; -import { DrawerActions } from "@dzcode.io/ui-mobile/dist/drawer/drawer-actions"; -import { DrawerContent } from "@dzcode.io/ui-mobile/dist/drawer/drawer-content"; -import { DrawerNav } from "@dzcode.io/ui-mobile/dist/navigation/drawer-nav"; -import React, { FC } from "react"; - -import { Navigation as ArticlesStack } from "./articles/navigation"; -import { ContributeScreen } from "./contribute"; -import { FAQScreen } from "./faq"; -import { Navigation as DocumentsStack } from "./learn/navigation"; -import { ProjectsScreen } from "./projects"; - -const routes: Route[] = [ - { - name: "contribute", - title: "Contribution Gallery", - label: "Contribute", - component: ContributeScreen, - }, - { - name: "learn", - title: "Read & Learn", - label: "Learn", - component: DocumentsStack, - }, - { - name: "projects", - title: "Projects Gallery", - label: "DZ Open-Source Projects", - component: ProjectsScreen, - }, - { - name: "articles", - title: "Articles", - label: "Read Articles", - component: ArticlesStack, - }, - { - name: "faq", - title: "Frequently Asked Questions", - label: "Have a Question?", - component: FAQScreen, - }, -]; - -export const Navigation: FC = () => { - return ( - ( - name === props.route.name)?.title || ""} - openDrawer={() => props.navigation.dispatch(DrawerActions.openDrawer())} - /> - )} - drawerContent={(props) => } - /> - ); -}; diff --git a/mobile/src/screens/projects/index.tsx b/mobile/src/screens/projects/index.tsx deleted file mode 100644 index 358409db8..000000000 --- a/mobile/src/screens/projects/index.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { ProjectCard } from "@dzcode.io/ui-mobile/dist/card/project-card"; -import { ErrorBoundary } from "@dzcode.io/ui-mobile/dist/error-boundary"; -import { DZCodeLoading } from "@dzcode.io/ui-mobile/dist/loading"; -import { TryAgain } from "@dzcode.io/ui-mobile/dist/try-again"; -import React, { FC, useEffect } from "react"; -import { FlatList, SafeAreaView, View } from "react-native"; -import { useDispatch } from "react-redux"; -import { AppDispatch } from "src/redux"; -import { fetchProjects } from "src/redux/actions/projects-screen"; -import { useProjectsSliceSelector } from "src/redux/reducers/projects-screen/slice"; -import { globalStyles } from "src/styles/global"; -import { openLink } from "src/utils/link"; - -export const ProjectsScreen: FC = () => { - const { projects, status } = useProjectsSliceSelector(); - - const dispatch = useDispatch(); - - useEffect(() => { - dispatch(fetchProjects()); - }, []); - - return ( - - - {status === "error" ? ( - dispatch(fetchProjects())} - /> - ) : projects ? ( - dispatch(fetchProjects())} - refreshing={status === "loading"} - keyExtractor={(_, index) => `item-${index}`} - renderItem={({ item }) => ( - openLink(url)} /> - )} - /> - ) : ( - - - - )} - - - ); -}; diff --git a/mobile/src/styles/global.ts b/mobile/src/styles/global.ts deleted file mode 100644 index b7073f966..000000000 --- a/mobile/src/styles/global.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { LARGE_TEXT_SIZE } from "@dzcode.io/ui-mobile/dist/_utils/constants"; -import { StyleSheet } from "react-native"; - -export const globalStyles = StyleSheet.create({ - // views - mainView: { - flex: 1, - }, - centerView: { - flex: 1, - justifyContent: "center", - alignItems: "center", - }, - row: { - flex: 1, - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - }, - flexView1: { - flex: 1, - }, - flexView2: { - flex: 2, - }, - flexView3: { - flex: 3, - }, - flexView4: { - flex: 4, - }, - flexView5: { - flex: 5, - }, - flexView6: { - flex: 6, - }, - flexView7: { - flex: 7, - }, - flexView15: { - flex: 1.5, - }, - flexView25: { - flex: 2.5, - }, - // texts - titleText: { - fontSize: LARGE_TEXT_SIZE, - fontWeight: "600", - }, -}); diff --git a/mobile/src/types/__global.d.ts b/mobile/src/types/__global.d.ts deleted file mode 100644 index 39d6ebbb5..000000000 --- a/mobile/src/types/__global.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export {}; - -declare global { - export const bundleInfo: BundleInfo; - interface Window { - bundleInfo: { - version: string; - environment: "production" | "stage" | "development"; - }; - } -} diff --git a/mobile/src/utils/env.ts b/mobile/src/utils/env.ts deleted file mode 100644 index 540853fdd..000000000 --- a/mobile/src/utils/env.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const getEnv = () => { - switch (window.bundleInfo.environment) { - case "production": - return "production"; - case "stage": - return "staging"; - default: - return "development"; - } -}; diff --git a/mobile/src/utils/fetch/index.ts b/mobile/src/utils/fetch/index.ts deleted file mode 100644 index 91e341659..000000000 --- a/mobile/src/utils/fetch/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Endpoints } from "@dzcode.io/api/dist/app/endpoints"; -import { fullstackConfig } from "src/config"; - -interface Endpoint { - params?: Record; - query?: [string, string][]; - body?: never; -} - -export const fetchV2 = async < - T extends Endpoints, - E extends keyof T, - C extends T[E], - D extends keyof C, ->( - endpoint: E, - config: Pick>, -): Promise => { - const { body, params, query } = config as Endpoint; - - const queryString = query ? "?" + query.map(([key, value]) => `${key}=${value}`).join("&") : ""; - - const domain = (endpoint as string).slice(0, (endpoint as string).indexOf(":")); - let url = (endpoint as string).slice(domain.length + 1); - - if (params) { - Object.keys(params).forEach((param) => { - url = url.replace(`:${param}`, params[param]); - }); - } - - let baseURL = ""; - - switch (domain) { - case "data": - baseURL = fullstackConfig.data.url; - break; - case "api": - baseURL = fullstackConfig.api.url; - break; - } - const response = await fetch(`${baseURL}/${url}${queryString}`, { body }); - return (await response.json()) as C[D & "response"]; -}; diff --git a/mobile/src/utils/link/index.ts b/mobile/src/utils/link/index.ts deleted file mode 100644 index a99a440c6..000000000 --- a/mobile/src/utils/link/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NavigationProp, ParamListBase } from "@react-navigation/core"; -import { Linking } from "react-native"; - -/** - * @function openLink - * @description Open a link in the default browser or navigate to the app's screen if the link is a deep link - * @param url The url to open - * @param navigation The navigation object - */ -export const openLink = (url: string, navigation?: NavigationProp) => { - if (url.startsWith("http")) { - try { - Linking.openURL(url); - } catch (error) { - alert("Cannot open url on browser"); - } - } else { - navigation?.navigate(url.split("/")[1].toLocaleLowerCase()); - } -}; diff --git a/mobile/src/utils/shuffle/index.ts b/mobile/src/utils/shuffle/index.ts deleted file mode 100644 index e9bb1544e..000000000 --- a/mobile/src/utils/shuffle/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @function shuffleArray - * @description Randomize the order of an array - */ -export const shuffleArray = (array: T[]) => { - let currentIndex = array.length, - temporaryValue, - randomIndex; - - // While there remain elements to shuffle... - while (0 !== currentIndex) { - // Pick a remaining element... - randomIndex = Math.floor(Math.random() * currentIndex); - currentIndex -= 1; - - // And swap it with the current element. - temporaryValue = array[currentIndex]; - array[currentIndex] = array[randomIndex]; - array[randomIndex] = temporaryValue; - } - - return array; -}; diff --git a/mobile/tsconfig.json b/mobile/tsconfig.json deleted file mode 100644 index 0e8702804..000000000 --- a/mobile/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "expo/tsconfig.base", - "compilerOptions": { - "strict": true, - "baseUrl": "." - }, - "include": ["src"], - "exclude": ["src/_e2e-test"] -} diff --git a/packages/tooling/.prettierignore b/packages/tooling/.prettierignore index 6b3bec763..e7bc2a296 100644 --- a/packages/tooling/.prettierignore +++ b/packages/tooling/.prettierignore @@ -9,9 +9,6 @@ oracle-cloud/build bundle .bundle-info.json -# mobile -.expo - ./.* .editorconfig .gitignore diff --git a/packages/tooling/sentry-release.ts b/packages/tooling/sentry-release.ts index 26acfc352..9bcdebd4c 100644 --- a/packages/tooling/sentry-release.ts +++ b/packages/tooling/sentry-release.ts @@ -19,15 +19,6 @@ if (!authToken) throw new Error("Please provide a authToken"); const org = "dzcode"; const project = scope; -if (scope === "mobile") { - console.log(`Creating, publishing and deploying a new Sentry release ...`); - const mobileScript = `SENTRY_AUTH_TOKEN=${authToken} SENTRY_ORG=${org} SENTRY_PROJECT=${project} SENTRY_RELEASE=${scope}@${version} SENTRY_DEPLOY_ENV=${environment} SENTRY_DIST=0 expo export --dump-sourcemap`; - console.log(`running:\n${mobileScript}`); - const mobileScriptStdout = String(execSync(mobileScript)); - console.log(mobileScriptStdout); - process.exit(0); -} - console.log(`Creating a Sentry release draft ...`); const releaseScript = `sentry-cli --auth-token ${authToken} releases --org ${org} new --project ${project} ${scope}@${version}`; console.log(`running:\n${releaseScript}`); diff --git a/packages/tooling/version-apply.ts b/packages/tooling/version-apply.ts index 4db61679e..4b31c7eb0 100644 --- a/packages/tooling/version-apply.ts +++ b/packages/tooling/version-apply.ts @@ -32,17 +32,6 @@ dependencies.forEach(({ location }) => { console.log(`Applied version ${version} to ${packageJsonPath}`); modifiedFilePaths.push(packageJsonPath); } - - const appJsonPath = join(location, "app.json"); - if (existsSync(appJsonPath)) { - const appJsonContent = require(appJsonPath); // eslint-disable-line @typescript-eslint/no-require-imports - appJsonContent.expo.version = cleanVersion; - appJsonContent.expo.ios.buildNumber = cleanVersion; - appJsonContent.expo.android.versionCode = Number(cleanVersion.replace(/\D/g, "")); - writeFileSync(appJsonPath, JSON.stringify(appJsonContent, null, 2)); - console.log(`Applied version ${version} to ${appJsonPath}`); - modifiedFilePaths.push(appJsonPath); - } }); // Run prettier to make sure the modified files are properly formatted diff --git a/packages/ui-mobile/assets/png/adaptive-icon.png b/packages/ui-mobile/assets/png/adaptive-icon.png deleted file mode 100644 index 7832a54a4..000000000 Binary files a/packages/ui-mobile/assets/png/adaptive-icon.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/branching.png b/packages/ui-mobile/assets/png/branching.png deleted file mode 100644 index 82dec0a23..000000000 Binary files a/packages/ui-mobile/assets/png/branching.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/contact.png b/packages/ui-mobile/assets/png/contact.png deleted file mode 100644 index 64d45ab20..000000000 Binary files a/packages/ui-mobile/assets/png/contact.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/favicon.png b/packages/ui-mobile/assets/png/favicon.png deleted file mode 100644 index 03bdf1047..000000000 Binary files a/packages/ui-mobile/assets/png/favicon.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/github.png b/packages/ui-mobile/assets/png/github.png deleted file mode 100644 index def33834d..000000000 Binary files a/packages/ui-mobile/assets/png/github.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/icon.png b/packages/ui-mobile/assets/png/icon.png deleted file mode 100644 index 83c5527c7..000000000 Binary files a/packages/ui-mobile/assets/png/icon.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/info.png b/packages/ui-mobile/assets/png/info.png deleted file mode 100644 index 4b9cca1e3..000000000 Binary files a/packages/ui-mobile/assets/png/info.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/logo.png b/packages/ui-mobile/assets/png/logo.png deleted file mode 100644 index b71f87018..000000000 Binary files a/packages/ui-mobile/assets/png/logo.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/programmer.png b/packages/ui-mobile/assets/png/programmer.png deleted file mode 100644 index cc7a7f6b7..000000000 Binary files a/packages/ui-mobile/assets/png/programmer.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/splash.png b/packages/ui-mobile/assets/png/splash.png deleted file mode 100644 index 2c5652ee4..000000000 Binary files a/packages/ui-mobile/assets/png/splash.png and /dev/null differ diff --git a/packages/ui-mobile/assets/png/support.png b/packages/ui-mobile/assets/png/support.png deleted file mode 100644 index 8c2c6a54f..000000000 Binary files a/packages/ui-mobile/assets/png/support.png and /dev/null differ diff --git a/packages/ui-mobile/assets/ttf/spacemono-regular.ttf b/packages/ui-mobile/assets/ttf/spacemono-regular.ttf deleted file mode 100644 index 28d7ff717..000000000 Binary files a/packages/ui-mobile/assets/ttf/spacemono-regular.ttf and /dev/null differ diff --git a/packages/ui-mobile/babel.config.js b/packages/ui-mobile/babel.config.js deleted file mode 100644 index 245ebb4de..000000000 --- a/packages/ui-mobile/babel.config.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - presets: ["module:metro-react-native-babel-preset"], - plugins: [ - [ - "module-resolver", - { - root: ["../"], - alias: { - src: "./src", - }, - }, - ], - ], -}; diff --git a/packages/ui-mobile/jest.config.ts b/packages/ui-mobile/jest.config.ts deleted file mode 100644 index 340676942..000000000 --- a/packages/ui-mobile/jest.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - preset: "jest-expo", - setupFiles: ["./src/_test/setup.ts"], - transformIgnorePatterns: [ - "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg|@sentry/*)", - ], -}; diff --git a/packages/ui-mobile/package.jsonc b/packages/ui-mobile/package.jsonc deleted file mode 100644 index 329778682..000000000 --- a/packages/ui-mobile/package.jsonc +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@dzcode.io/ui-mobile", - "description": "dzcode.io mobile ui library", - "version": "5.3.6", - "author": { - "email": "omarbelghaouti@gmail.com", - "name": "Omar Belghaouti", - "url": "https://omar-belghaouti.web.app" - }, - "dependencies": { - "@expo-google-fonts/roboto": "^0.2.2", - "@gorhom/bottom-sheet": "^4", - "@react-navigation/bottom-tabs": "^6.5.7", - "@react-navigation/drawer": "^6.6.2", - "@react-navigation/native": "^6.1.6", - "@react-navigation/stack": "^6.3.16", - "@sentry/react-native": "^5.3.0", - "jest-expo": "^48.0.2", - "react-native-gesture-handler": "^2.9.0", - "react-native-markdown-display": "^7.0.0-alpha.2", - "react-native-paper": "^5.2.2", - "react-native-reanimated": "~2.14.4", - "react-native-safe-area-context": "4.2.4", - "react-native-screens": "^3.20.0" - }, - "devDependencies": { - "@dzcode.io/models": "*", - "@dzcode.io/tooling": "*", - "@testing-library/react-native": "^11.1.0" - }, - "license": "MIT", - "lint-staged": { - "*.*": [ - "yarn lint:eslint --fix", - "yarn lint:prettier --write" - ] - }, - "main": "dist", - "private": true, - "scripts": { - "build": "lerna run build:alone --scope=@dzcode.io/ui-mobile --include-dependencies --stream", - "build:alone": "tsc", - "build:alone:watch": "tsc --watch --preserveWatchOutput", - "build:watch": "yarn build & yarn lerna run build:alone:watch --scope=@dzcode.io/ui-mobile --include-dependencies --parallel", - "clean": "lerna run clean:alone --scope=@dzcode.io/ui-mobile --include-dependencies --stream", - "clean:alone": "rimraf dist coverage", - "lint": "yarn build && yarn lint:alone", - "lint:alone": "yarn lint:eslint . && yarn lint:prettier --check .", - "lint:eslint": "eslint --config ../tooling/.eslintrc.json --ignore-path ../tooling/.eslintignore --report-unused-disable-directives", - "lint:fix": "yarn build && yarn lint:fix:alone", - "lint:fix:alone": "yarn lint:eslint --fix . && yarn lint:prettier --write .", - "lint:prettier": "prettier --config ../tooling/.prettierrc --ignore-path ../tooling/.prettierignore --log-level warn", - "test": "yarn build && yarn test:alone", - "test:alone": "echo \"skipped for now\"", - "test:watch": "npm-run-all build --parallel build:watch \"test:alone --watch {@}\" --" - } -} diff --git a/packages/ui-mobile/src/_hooks/use-navigation.ts b/packages/ui-mobile/src/_hooks/use-navigation.ts deleted file mode 100644 index 81e5d8aa7..000000000 --- a/packages/ui-mobile/src/_hooks/use-navigation.ts +++ /dev/null @@ -1 +0,0 @@ -export { useNavigation } from "@react-navigation/native"; diff --git a/packages/ui-mobile/src/_hooks/use-theme.ts b/packages/ui-mobile/src/_hooks/use-theme.ts deleted file mode 100644 index 0a1c60f56..000000000 --- a/packages/ui-mobile/src/_hooks/use-theme.ts +++ /dev/null @@ -1 +0,0 @@ -export { useTheme } from "react-native-paper"; diff --git a/packages/ui-mobile/src/_test/pre-test.ts b/packages/ui-mobile/src/_test/pre-test.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/ui-mobile/src/_test/setup.ts b/packages/ui-mobile/src/_test/setup.ts deleted file mode 100644 index 24bf227fc..000000000 --- a/packages/ui-mobile/src/_test/setup.ts +++ /dev/null @@ -1,23 +0,0 @@ -jest.mock("react-native-reanimated", () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const Reanimated = require("react-native-reanimated/mock"); - - // The mock for `call` immediately calls the callback which is incorrect - // So we override it with a no-op - Reanimated.default.call = () => undefined; - - return Reanimated; -}); - -// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing -jest.mock("react-native/Libraries/Animated/NativeAnimatedHelper"); - -jest.mock("@gorhom/bottom-sheet", () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const react = require("react-native"); - return { - __esModule: true, - default: react.View, - BottomSheetScrollView: react.ScrollView, - }; -}); diff --git a/packages/ui-mobile/src/_types/filter.ts b/packages/ui-mobile/src/_types/filter.ts deleted file mode 100644 index cea476da0..000000000 --- a/packages/ui-mobile/src/_types/filter.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Option } from "./option"; - -/** - * Type used in `@dzcode.io/api` package to filter contributions - * @example - * let filter: Filter = { - * name: "filter", - * label: "Filter", - * options: [ - * { - * label: "All", - * name: "all", - * checked: true, - * }, - * ], - * }; - */ -export interface Filter { - /** - * the name of the filter - */ - name: string; - /** - * the options of the filter - */ - options: Option[]; -} diff --git a/packages/ui-mobile/src/_types/option.ts b/packages/ui-mobile/src/_types/option.ts deleted file mode 100644 index 719df3446..000000000 --- a/packages/ui-mobile/src/_types/option.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Type used in `@dzcode.io/api` package to help with filtering contributions - * @example - * let option: Option = { - * label: "All", - * name: "all", - * checked: true, - * }; - */ -export interface Option { - /** - * the label of the option - */ - label?: string; - /** - * the name of the option - */ - name: string; - /** - * whether the option is checked or not - */ - checked?: boolean; -} diff --git a/packages/ui-mobile/src/_types/project.ts b/packages/ui-mobile/src/_types/project.ts deleted file mode 100644 index e25c435c8..000000000 --- a/packages/ui-mobile/src/_types/project.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Type used in `@dzcode.io/api` package to represent a project - * @example - * let project: Project = { - * slug: "dzcode-io", - * description: "dzcode.io is an open source project that aims to provide a platform for Algerian developers to share their knowledge and experience with the community.", - * githubURI: "https://github.com/dzcode-io/dzcode.io" - * }; - */ -export interface Project { - /** - * the slug of the project - */ - slug: string; - /** - * the image url of the project - */ - image?: string; - /** - * the name of the project - */ - name: string; - /** - * the description of the project - */ - description?: string; - /** - * the content of the project - */ - content?: string; - /** - * the author of the project - */ - authors?: string[]; - /** - * the contributors of the project - */ - contributors?: string[]; - /** - * the number of views of the project - */ - views?: number; - /** - * the github uri of the project - */ - githubURI?: string; -} diff --git a/packages/ui-mobile/src/_types/route-param.ts b/packages/ui-mobile/src/_types/route-param.ts deleted file mode 100644 index f7f51eca3..000000000 --- a/packages/ui-mobile/src/_types/route-param.ts +++ /dev/null @@ -1 +0,0 @@ -export { Route as RouteParam } from "@react-navigation/routers"; diff --git a/packages/ui-mobile/src/_types/route.ts b/packages/ui-mobile/src/_types/route.ts deleted file mode 100644 index 509d26459..000000000 --- a/packages/ui-mobile/src/_types/route.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Type used to define navigation routes - * @example - * import type { Route } from "@dzcode.io/ui-mobile/dist/_types/route"; - * import { StackNav } from "@dzcode.io/ui-mobile/dist/navigation/stack-nav"; - * import { FC } from "react"; - * import { DocumentDetailsScreen } from "./document-details"; - * import { DocumentsListScreen } from "./documents-list"; - * - * const routes: Route[] = [ - * { - * name: "documents-list", - * component: DocumentsListScreen, - * }, - * { - * name: "document-details", - * component: DocumentDetailsScreen, - * }, - * ]; - * - * export const Navigation: FC = () => { - * return ( - * - * ); - * }; - */ -export interface Route { - /** - * the name of the route - */ - name: string; - /** - * the title of the route - */ - title?: string; - /** - * the label of the route - */ - label?: string; - /** - * the component of the route - */ - component: React.ComponentType; -} diff --git a/packages/ui-mobile/src/_utils/constants.ts b/packages/ui-mobile/src/_utils/constants.ts deleted file mode 100644 index ad36f1a80..000000000 --- a/packages/ui-mobile/src/_utils/constants.ts +++ /dev/null @@ -1,28 +0,0 @@ -// padding sizes -export const SMALL_PADDING_SIZE = 5; -export const MEDIUM_PADDING_SIZE = 10; -export const LARGE_PADDING_SIZE = 25; - -// logo sizes -export const SMALL_LOGO_WIDTH = 50; -export const MEDIUM_LOGO_WIDTH = 100; -export const LARGE_LOGO_WIDTH = 260; -export const SMALL_LOGO_HEIGHT = 50; -export const MEDIUM_LOGO_HEIGHT = 100; -export const LARGE_LOGO_HEIGHT = 260; - -// margin sizes -export const SMALL_MARGIN_SIZE = 5; -export const MEDIUM_MARGIN_SIZE = 10; -export const LARGE_MARGIN_SIZE = 25; - -// text sizes -export const SMALL_TEXT_SIZE = 13; -export const MEDIUM_TEXT_SIZE = 19; -export const LARGE_TEXT_SIZE = 23; -export const BIG_TEXT_SIZE = 30; -export const HUGE_TEXT_SIZE = 50; - -// border radius sizes -export const SMALL_BORDER_RADIUS = 10; -export const MEDIUM_BORDER_RADIUS = 20; diff --git a/packages/ui-mobile/src/app-bar/index.test.tsx b/packages/ui-mobile/src/app-bar/index.test.tsx deleted file mode 100644 index 21bb30565..000000000 --- a/packages/ui-mobile/src/app-bar/index.test.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { AppBar } from "."; - -describe("AppBar", () => { - it("should render", () => { - const { container } = render( - console.log("open drawer")} />, - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/app-bar/index.tsx b/packages/ui-mobile/src/app-bar/index.tsx deleted file mode 100644 index 64f6aba72..000000000 --- a/packages/ui-mobile/src/app-bar/index.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { FC } from "react"; -import { Appbar, useTheme } from "react-native-paper"; - -interface AppBarProps { - /** - * the title of the app bar - */ - title: string; - /** - * the function that is called when the menu icon is pressed - */ - openDrawer: VoidFunction; -} - -/** - * AppBar component used to display the app bar in the app - * @example - * ( - * name === props.scene.route.name)?.title || ""} - * openDrawer={() => props.scene.descriptor.navigation.dispatch(DrawerActions.openDrawer())} - * /> - * )} - * /> - */ -export const AppBar: FC = ({ title, openDrawer }) => { - const theme = useTheme(); - - return ( - - {/* Appbar content */} - openDrawer()} - hasTVPreferredFocus - tvParallaxProperties={{ enabled: true }} - /> - - - ); -}; diff --git a/packages/ui-mobile/src/avatar/avatar-group/index.test.tsx b/packages/ui-mobile/src/avatar/avatar-group/index.test.tsx deleted file mode 100644 index 266d8e606..000000000 --- a/packages/ui-mobile/src/avatar/avatar-group/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { AvatarGroup } from "."; - -describe("AvatarGroup", () => { - it("should render", () => { - const { container } = render(); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/avatar/avatar-group/index.tsx b/packages/ui-mobile/src/avatar/avatar-group/index.tsx deleted file mode 100644 index 8e8b11ab7..000000000 --- a/packages/ui-mobile/src/avatar/avatar-group/index.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import type { FC } from "react"; -import React from "react"; -import type { ViewStyle } from "react-native"; -import { View } from "react-native"; -import { useTheme } from "src/_hooks/use-theme"; -import { Avatar } from "src/avatar/avatar"; - -import { avatarGroupStyles } from "./styles"; - -interface AvatarGroupProps { - /** - * max number of avatars to be shown (defaults to 3) - */ - max?: number; - /** - * list of avatar uris - */ - avatarUris: string[]; - /** - * style for avatar group container - */ - style?: ViewStyle; -} - -/** - * AvatarGroup component to display group of avatars - * @example - * - */ -export const AvatarGroup: FC = ({ max = 3, avatarUris, style }) => { - const { colors } = useTheme(); - const rest = avatarUris.length - max + 1; - return ( - - {avatarUris.map((uri, index) => { - if (index < max - 1) { - return ( - - - - ); - } else if (index === max) { - return ( - - - - ); - } else { - return ; - } - })} - - ); -}; diff --git a/packages/ui-mobile/src/avatar/avatar-group/styles.ts b/packages/ui-mobile/src/avatar/avatar-group/styles.ts deleted file mode 100644 index c3b6cf669..000000000 --- a/packages/ui-mobile/src/avatar/avatar-group/styles.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { StyleSheet } from "react-native"; -import { MEDIUM_MARGIN_SIZE, MEDIUM_TEXT_SIZE } from "src/_utils/constants"; - -export const avatarGroupStyles = StyleSheet.create({ - row: { - flexDirection: "row", - alignItems: "center", - }, - avatarContainer: { - marginRight: -MEDIUM_MARGIN_SIZE * 1.5, - borderWidth: 5, - justifyContent: "center", - alignItems: "center", - borderRadius: 64, - }, - avatarLabelText: { - fontSize: MEDIUM_TEXT_SIZE, - fontWeight: "bold", - }, -}); diff --git a/packages/ui-mobile/src/avatar/avatar/index.test.tsx b/packages/ui-mobile/src/avatar/avatar/index.test.tsx deleted file mode 100644 index 929cecb83..000000000 --- a/packages/ui-mobile/src/avatar/avatar/index.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { Avatar } from "."; - -describe("Avatar", () => { - it("should render", () => { - const { container } = render( - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/avatar/avatar/index.ts b/packages/ui-mobile/src/avatar/avatar/index.ts deleted file mode 100644 index 9b6af320f..000000000 --- a/packages/ui-mobile/src/avatar/avatar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Avatar } from "react-native-paper"; diff --git a/packages/ui-mobile/src/badge/index.test.tsx b/packages/ui-mobile/src/badge/index.test.tsx deleted file mode 100644 index 61c448d9e..000000000 --- a/packages/ui-mobile/src/badge/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { Badge } from "."; - -describe("Badge", () => { - it("should render", () => { - const { container } = render(); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/badge/index.ts b/packages/ui-mobile/src/badge/index.ts deleted file mode 100644 index 5857e5561..000000000 --- a/packages/ui-mobile/src/badge/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Badge } from "react-native-paper"; diff --git a/packages/ui-mobile/src/bottom-sheet/bottom-sheet-scroll-view/index.test.tsx b/packages/ui-mobile/src/bottom-sheet/bottom-sheet-scroll-view/index.test.tsx deleted file mode 100644 index 7106442f5..000000000 --- a/packages/ui-mobile/src/bottom-sheet/bottom-sheet-scroll-view/index.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { Text } from "react-native"; - -import { BottomSheetScrollView } from "."; - -describe("BottomSheetScrollView", () => { - it("should render", () => { - const { container } = render( - - Test - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/bottom-sheet/bottom-sheet-scroll-view/index.ts b/packages/ui-mobile/src/bottom-sheet/bottom-sheet-scroll-view/index.ts deleted file mode 100644 index e162d9ee7..000000000 --- a/packages/ui-mobile/src/bottom-sheet/bottom-sheet-scroll-view/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { BottomSheetScrollView } from "@gorhom/bottom-sheet"; diff --git a/packages/ui-mobile/src/bottom-sheet/bottom-sheet/index.test.tsx b/packages/ui-mobile/src/bottom-sheet/bottom-sheet/index.test.tsx deleted file mode 100644 index 8f50ac21e..000000000 --- a/packages/ui-mobile/src/bottom-sheet/bottom-sheet/index.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { Text } from "react-native"; - -import { BottomSheet } from "."; - -describe("BottomSheet", () => { - it("should render", () => { - const { container } = render( - - Test - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/bottom-sheet/bottom-sheet/index.tsx b/packages/ui-mobile/src/bottom-sheet/bottom-sheet/index.tsx deleted file mode 100644 index 6037f60a8..000000000 --- a/packages/ui-mobile/src/bottom-sheet/bottom-sheet/index.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { default as BottomSheetWrapper } from "@gorhom/bottom-sheet"; -import { FC } from "react"; -import { useTheme } from "src/_hooks/use-theme"; - -import { bottomSheetStyles } from "./styles"; - -interface BottomSheetProps { - /** - * the children of the bottom sheet - */ - children: React.ReactNode; -} - -/** - * BottomSheet component used to display the bottom sheet in the app - * @example - * - * Bottom Sheet Content - * - */ -export const BottomSheet: FC = ({ children }) => { - const { colors } = useTheme(); - return ( - - {children} - - ); -}; diff --git a/packages/ui-mobile/src/bottom-sheet/bottom-sheet/styles.ts b/packages/ui-mobile/src/bottom-sheet/bottom-sheet/styles.ts deleted file mode 100644 index dff7bc3ea..000000000 --- a/packages/ui-mobile/src/bottom-sheet/bottom-sheet/styles.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { StyleSheet } from "react-native"; - -export const bottomSheetStyles = StyleSheet.create({ - container: { - borderColor: "#aaa3", - borderWidth: 2, - borderRadius: 16, - - // Android - elevation: 8, - }, -}); diff --git a/packages/ui-mobile/src/button/index.test.tsx b/packages/ui-mobile/src/button/index.test.tsx deleted file mode 100644 index b87420471..000000000 --- a/packages/ui-mobile/src/button/index.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { Text } from "react-native"; - -import { Button } from "."; - -describe("Button", () => { - it("should render", () => { - const { container } = render( - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/button/index.ts b/packages/ui-mobile/src/button/index.ts deleted file mode 100644 index 6f0b7036f..000000000 --- a/packages/ui-mobile/src/button/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Button } from "react-native-paper"; diff --git a/packages/ui-mobile/src/card/card/index.test.tsx b/packages/ui-mobile/src/card/card/index.test.tsx deleted file mode 100644 index fd240827e..000000000 --- a/packages/ui-mobile/src/card/card/index.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { Text } from "react-native"; - -import { Card } from "."; - -describe("Card", () => { - it("should render", () => { - const { container } = render( - - Card - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/card/card/index.ts b/packages/ui-mobile/src/card/card/index.ts deleted file mode 100644 index d51aefefb..000000000 --- a/packages/ui-mobile/src/card/card/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Card } from "react-native-paper"; diff --git a/packages/ui-mobile/src/card/contribute-card/index.test.tsx b/packages/ui-mobile/src/card/contribute-card/index.test.tsx deleted file mode 100644 index b8a6a241b..000000000 --- a/packages/ui-mobile/src/card/contribute-card/index.test.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { ContributeCard } from "."; - -describe("ContributeCard", () => { - it("should render", () => { - const { container } = render( - undefined} - onPress={() => undefined} - item={{ - title: "test", - project: { - name: "test", - slug: "test", - }, - type: "issue", - labels: [], - commentsCount: 0, - createdAt: "", - updatedAt: "", - id: "", - languages: [], - url: "", - }} - />, - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/card/contribute-card/index.tsx b/packages/ui-mobile/src/card/contribute-card/index.tsx deleted file mode 100644 index d471f78f9..000000000 --- a/packages/ui-mobile/src/card/contribute-card/index.tsx +++ /dev/null @@ -1,140 +0,0 @@ -import { Model } from "@dzcode.io/models/dist/_base"; -import { ContributionEntity } from "@dzcode.io/models/dist/contribution"; -import { calculateDateBetween } from "@dzcode.io/utils/dist/date/difference"; -import MaterialIcons from "@expo/vector-icons/MaterialIcons"; -import React, { FC, memo } from "react"; -import { FlatList } from "react-native"; -import { View } from "react-native"; -import { useTheme } from "src/_hooks/use-theme"; -import { Badge } from "src/badge"; -import { Card } from "src/card/card"; -import { Chip } from "src/chip"; -import { Divider } from "src/divider"; -import { Paragraph } from "src/text/paragraph"; -import { Text } from "src/text/text"; -import { Title } from "src/text/title"; -import { Colors } from "src/theme/style/color"; - -import { cardStyles } from "./styles"; - -interface ContributeCardProps { - /** - * the contribution item - */ - item: Model; - /** - * the function that is called when a chip is pressed - */ - onChipPress: (item: string) => void; - /** - * the function that is called when the contribute card is pressed - */ - onPress: () => void; -} - -const CardItem: FC = ({ item, onChipPress, onPress }: ContributeCardProps) => { - const { colors } = useTheme(); - return ( - - - {item.title} - - {item.labels.length > 0 && ( - label} - renderItem={({ item }) => ( - onChipPress(item)} style={cardStyles.chipView}> - {item} - - )} - /> - )} - {item.project.name} - language} - renderItem={({ item }) => ( - onChipPress(item)} style={cardStyles.chipView}> - {item} - - )} - /> - - - - - {item.type === "issue" ? "Learn more" : "Review changes"} - - - {item.commentsCount > 0 && ( - - - - {item.commentsCount} - - - )} - - {calculateDateBetween(new Date(item.updatedAt), new Date())} - - - - - ); -}; - -/** - * ContributeCard component used to display the contribute card in the app - * @example - * {}} - onPress={() => {}} - item={{ - title: "test", - project: { - name: "test", - slug: "test", - }, - type: "issue", - labels: [], - commentsCount: 0, - createdAt: "2023-03-04T00:00:00.000Z", - updatedAt: "2023-03-04T00:00:00.000Z", - id: "", - languages: [], - url: "", - }} - /> - */ -export const ContributeCard = memo(CardItem); diff --git a/packages/ui-mobile/src/card/contribute-card/styles.ts b/packages/ui-mobile/src/card/contribute-card/styles.ts deleted file mode 100644 index 1664e87f9..000000000 --- a/packages/ui-mobile/src/card/contribute-card/styles.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { StyleSheet } from "react-native"; -import { MEDIUM_MARGIN_SIZE, SMALL_MARGIN_SIZE, SMALL_TEXT_SIZE } from "src/_utils/constants"; - -export const cardStyles = StyleSheet.create({ - mainView: { - marginHorizontal: MEDIUM_MARGIN_SIZE, - marginVertical: MEDIUM_MARGIN_SIZE / 2, - borderWidth: 1, - }, - flatListView: { - marginTop: MEDIUM_MARGIN_SIZE, - }, - chipView: { - marginHorizontal: SMALL_MARGIN_SIZE / 2, - }, - badgeView: { - backgroundColor: "transparent", - position: "absolute", - bottom: -7, - right: -7, - fontSize: SMALL_TEXT_SIZE, - }, - marginRight: { - marginRight: MEDIUM_MARGIN_SIZE, - }, - flexRow: { - flex: 1, - flexDirection: "row", - justifyContent: "space-between", - }, - row: { - flexDirection: "row", - alignItems: "center", - }, - cardActionsView: { - flexDirection: "row", - alignItems: "center", - justifyContent: "space-between", - }, - subtitleText: { - marginTop: SMALL_MARGIN_SIZE, - }, - divider1: { - height: 1, - marginTop: 10, - marginLeft: -16, - width: "50%", - }, - divider2: { - height: 15, - width: 1, - marginRight: MEDIUM_MARGIN_SIZE, - }, -}); diff --git a/packages/ui-mobile/src/card/project-card/index.test.tsx b/packages/ui-mobile/src/card/project-card/index.test.tsx deleted file mode 100644 index 20fe79c83..000000000 --- a/packages/ui-mobile/src/card/project-card/index.test.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { ProjectCard } from "."; - -describe("ProjectCard", () => { - it("should render", () => { - const { container } = render( - undefined} - />, - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/card/project-card/index.tsx b/packages/ui-mobile/src/card/project-card/index.tsx deleted file mode 100644 index caffd6d99..000000000 --- a/packages/ui-mobile/src/card/project-card/index.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import { Model } from "@dzcode.io/models/dist/_base"; -import { ProjectEntity } from "@dzcode.io/models/dist/project"; -import { RepositoryEntity } from "@dzcode.io/models/dist/repository"; -import { getRepositoryURL } from "@dzcode.io/models/dist/repository-reference/utils"; -import MaterialIcons from "@expo/vector-icons/MaterialIcons"; -import { FC, memo } from "react"; -import { Dimensions } from "react-native"; -import { ScrollView } from "react-native"; -import { View } from "react-native"; -import { useTheme } from "src/_hooks/use-theme"; -import { AvatarGroup } from "src/avatar/avatar-group"; -import { Badge } from "src/badge"; -import { Button } from "src/button"; -import { Card } from "src/card/card"; -import { Chip } from "src/chip"; -import { Divider } from "src/divider"; -import { Title } from "src/text/title"; - -import { cardStyles } from "./styles"; - -interface ProjectCardProps { - project: Model & { - repositories: Model[]; - }; - openLink: (url: string) => void; -} - -const CardItem: FC = ({ - project: { name, repositories }, - - openLink, -}: ProjectCardProps) => { - const width = Dimensions.get("window").width; - const { colors } = useTheme(); - return ( - - - {name} - - - - {repositories.map((repository, index) => { - let link = `${repository.owner}/${repository.repository}`; - link = link.length >= width / 10 ? link.slice(0, width / 10) + "..." : link; - const avatarUris = repository.contributors.map((contributor) => contributor.avatarUrl); - return ( - - - - - {repository.stats.contributionCount > 0 && ( - - - - {repository.stats.contributionCount} - - - )} - - {repository.stats.languages.length > 0 && ( - - - {repository.stats.languages.map((lang) => ( - - {lang} - - ))} - - - )} - - ); - })} - - - ); -}; - -/** - * ProjectCard component used to display the project card in the app - * @prop {Model} project - the project to display - * @prop {Function} openLink - the function to open the link - * @example - * Linking.openURL(url)} - * /> - */ -export const ProjectCard = memo(CardItem); diff --git a/packages/ui-mobile/src/card/project-card/styles.ts b/packages/ui-mobile/src/card/project-card/styles.ts deleted file mode 100644 index dfdb637b4..000000000 --- a/packages/ui-mobile/src/card/project-card/styles.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { StyleSheet } from "react-native"; -import { LARGE_MARGIN_SIZE, MEDIUM_MARGIN_SIZE, MEDIUM_TEXT_SIZE } from "src/_utils/constants"; - -export const cardStyles = StyleSheet.create({ - mainView: { - marginHorizontal: MEDIUM_MARGIN_SIZE, - marginVertical: MEDIUM_MARGIN_SIZE / 2, - borderWidth: 1, - }, - reposColumn: { - flex: 1, - alignItems: "flex-start", - }, - divider1: { - height: 1, - marginTop: 10, - marginLeft: -16, - width: "50%", - }, - divider2: { - marginLeft: LARGE_MARGIN_SIZE, - height: 40, - width: 1, - marginRight: MEDIUM_MARGIN_SIZE, - }, - row: { - flexDirection: "row", - alignItems: "center", - marginBottom: MEDIUM_MARGIN_SIZE, - }, - badgeView: { - backgroundColor: "transparent", - position: "absolute", - bottom: -12, - right: -12, - fontSize: MEDIUM_TEXT_SIZE, - }, - marginRight: { - marginLeft: LARGE_MARGIN_SIZE, - }, - flatListView: { - marginLeft: MEDIUM_MARGIN_SIZE, - marginBottom: MEDIUM_MARGIN_SIZE, - }, - chipView: { - marginRight: MEDIUM_MARGIN_SIZE, - }, - avatarGroup: { - marginLeft: MEDIUM_MARGIN_SIZE, - }, -}); diff --git a/packages/ui-mobile/src/checkbox/index.test.tsx b/packages/ui-mobile/src/checkbox/index.test.tsx deleted file mode 100644 index 09bc068ef..000000000 --- a/packages/ui-mobile/src/checkbox/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { Checkbox } from "."; - -describe("Checkbox", () => { - it("should render", () => { - const { container } = render(); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/checkbox/index.ts b/packages/ui-mobile/src/checkbox/index.ts deleted file mode 100644 index 716321308..000000000 --- a/packages/ui-mobile/src/checkbox/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Checkbox } from "react-native-paper"; diff --git a/packages/ui-mobile/src/chip/index.test.tsx b/packages/ui-mobile/src/chip/index.test.tsx deleted file mode 100644 index 8d186aab8..000000000 --- a/packages/ui-mobile/src/chip/index.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { Text } from "react-native"; - -import { Chip } from "."; - -describe("Chip", () => { - it("should render", () => { - const { container } = render( - - Chip - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/chip/index.ts b/packages/ui-mobile/src/chip/index.ts deleted file mode 100644 index 5d17214da..000000000 --- a/packages/ui-mobile/src/chip/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Chip } from "react-native-paper"; diff --git a/packages/ui-mobile/src/divider/index.test.tsx b/packages/ui-mobile/src/divider/index.test.tsx deleted file mode 100644 index 526d1ab67..000000000 --- a/packages/ui-mobile/src/divider/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { Divider } from "."; - -describe("Divider", () => { - it("should render", () => { - const { container } = render(); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/divider/index.ts b/packages/ui-mobile/src/divider/index.ts deleted file mode 100644 index 3b84feca0..000000000 --- a/packages/ui-mobile/src/divider/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Divider } from "react-native-paper"; diff --git a/packages/ui-mobile/src/drawer/drawer-actions/index.ts b/packages/ui-mobile/src/drawer/drawer-actions/index.ts deleted file mode 100644 index 3a40e729e..000000000 --- a/packages/ui-mobile/src/drawer/drawer-actions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { DrawerActions } from "@react-navigation/native"; diff --git a/packages/ui-mobile/src/drawer/drawer-content/index.test.tsx b/packages/ui-mobile/src/drawer/drawer-content/index.test.tsx deleted file mode 100644 index 52c508cfa..000000000 --- a/packages/ui-mobile/src/drawer/drawer-content/index.test.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { SafeAreaProvider } from "react-native-safe-area-context"; - -import { DrawerContent } from "."; - -describe("DrawerContent", () => { - it("should render", () => { - const props = { - progress: { - " __value": 0, - isNativelyInitialized: jest.fn(), - }, - state: { - index: 0, - key: "drawer", - routeNames: ["Home"], - routes: [ - { - key: "Home", - name: "Home", - }, - ], - stale: false, - type: "drawer", - history: [], - }, - navigation: { - canGoBack: jest.fn(), - dangerouslyGetParent: jest.fn(), - dangerouslyGetState: jest.fn(), - dispatch: jest.fn(), - emit: jest.fn(), - goBack: jest.fn(), - isFocused: jest.fn(), - navigate: jest.fn(), - reset: jest.fn(), - setParams: jest.fn(), - toggleDrawer: jest.fn(), - closeDrawer: jest.fn(), - openDrawer: jest.fn(), - getParent: jest.fn(), - getState: jest.fn(), - jumpTo: jest.fn(), - }, - descriptors: { - Home: { - navigation: { - canGoBack: jest.fn(), - dangerouslyGetParent: jest.fn(), - dangerouslyGetState: jest.fn(), - dispatch: jest.fn(), - goBack: jest.fn(), - isFocused: jest.fn(), - navigate: jest.fn(), - reset: jest.fn(), - setParams: jest.fn(), - getParent: jest.fn(), - getState: jest.fn(), - addListener: jest.fn(), - removeListener: jest.fn(), - setOptions: jest.fn(), - }, - options: {}, - render: jest.fn(), - }, - }, - }; - const { container } = render( - - - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/drawer/drawer-content/index.tsx b/packages/ui-mobile/src/drawer/drawer-content/index.tsx deleted file mode 100644 index b1020aaf5..000000000 --- a/packages/ui-mobile/src/drawer/drawer-content/index.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* @eslint-disable @typescript-eslint/no-var-requires */ -import { - DrawerContentComponentProps, - DrawerContentScrollView, - DrawerItemList, -} from "@react-navigation/drawer"; -import { FC } from "react"; -import { Image, SafeAreaView, View } from "react-native"; -import { Text } from "react-native-paper"; - -import { drawerStyles } from "./styles"; - -interface DrawerContentProps extends DrawerContentComponentProps { - /** - * the version of the app - */ - version: string; -} - -/** - * DrawerContent component used to display the drawer content in the app - * @example - * - * @see https://reactnavigation.org/docs/drawer-navigator/ - */ -export const DrawerContent: FC = (props) => { - return ( - - - {/* dzcode.io logo */} - - - {props.version} - - {/* Drawer items */} - - - - ); -}; diff --git a/packages/ui-mobile/src/drawer/drawer-content/styles.ts b/packages/ui-mobile/src/drawer/drawer-content/styles.ts deleted file mode 100644 index a98c43214..000000000 --- a/packages/ui-mobile/src/drawer/drawer-content/styles.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { StyleSheet } from "react-native"; -import { - LARGE_LOGO_WIDTH, - LARGE_MARGIN_SIZE, - MEDIUM_MARGIN_SIZE, - SMALL_LOGO_HEIGHT, - SMALL_MARGIN_SIZE, -} from "src/_utils/constants"; - -export const drawerStyles = StyleSheet.create({ - logoView: { - width: LARGE_LOGO_WIDTH, - height: SMALL_LOGO_HEIGHT, - resizeMode: "stretch", - margin: MEDIUM_MARGIN_SIZE, - marginTop: LARGE_MARGIN_SIZE, - marginBottom: 0, - }, - version: { - margin: MEDIUM_MARGIN_SIZE, - marginBottom: LARGE_MARGIN_SIZE, - textAlign: "center", - }, - switchView: { - marginHorizontal: SMALL_MARGIN_SIZE, - }, -}); diff --git a/packages/ui-mobile/src/error-boundary/index.test.tsx b/packages/ui-mobile/src/error-boundary/index.test.tsx deleted file mode 100644 index ed4bea366..000000000 --- a/packages/ui-mobile/src/error-boundary/index.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { View } from "react-native"; - -import { ErrorBoundary } from "."; - -describe("ErrorBoundary", () => { - it("should render", () => { - const { container } = render( - - - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/error-boundary/index.tsx b/packages/ui-mobile/src/error-boundary/index.tsx deleted file mode 100644 index 0d3de2950..000000000 --- a/packages/ui-mobile/src/error-boundary/index.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { ErrorBoundary as SentryErrorBoundary } from "@sentry/react-native"; -import { FC } from "react"; -import { Linking, View } from "react-native"; -import { Button, Headline } from "react-native-paper"; - -interface ErrorBoundaryProps { - /** - * the children of the error boundary - */ - children?: React.ReactNode; - /** - * the message to display when an error is caught - */ - message?: string; -} - -/** - * ErrorBoundary component used to display a fallback UI when an error is caught - * @example - * - * Content - * - */ -export const ErrorBoundary: FC = ({ - children, - message = "Ops, something broke, we're checking on our end...", -}) => ( - - {message} - - - } - > - {children} - -); diff --git a/packages/ui-mobile/src/filter/index.test.tsx b/packages/ui-mobile/src/filter/index.test.tsx deleted file mode 100644 index c137ccc30..000000000 --- a/packages/ui-mobile/src/filter/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { Filters } from "."; - -describe("Filters", () => { - it("should render", () => { - const { container } = render( undefined} />); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/filter/index.tsx b/packages/ui-mobile/src/filter/index.tsx deleted file mode 100644 index 286ea55f1..000000000 --- a/packages/ui-mobile/src/filter/index.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { FC } from "react"; -import type { Filter } from "src/_types/filter"; -import { Checkbox } from "src/checkbox"; -import { List } from "src/list"; - -interface FilterProps { - /** - * the filters to display - */ - filters: Filter[]; - /** - * the function to call when a checkbox is pressed - */ - onCheckboxPress: (filterName: string, optionName: string) => void; -} - -/** - * Filters component used to display the list of filters coming from `@dzcode.io/api` in the app - * @example - * console.log(filterName, optionName)} - * /> - */ -export const Filters: FC = ({ filters, onCheckboxPress }) => { - return ( - - {filters.map(({ name: filterName, options }) => ( - - {options.map(({ label: optionLabel, name: optionName, checked }) => ( - ( - { - onCheckboxPress(filterName, optionName); - }} - /> - )} - onPress={() => { - onCheckboxPress(filterName, optionName); - }} - /> - ))} - - ))} - - ); -}; diff --git a/packages/ui-mobile/src/list/index.test.tsx b/packages/ui-mobile/src/list/index.test.tsx deleted file mode 100644 index e0a0300cd..000000000 --- a/packages/ui-mobile/src/list/index.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { Text } from "react-native"; - -import { List } from "."; - -describe("List", () => { - it("should render", () => { - const { container } = render( - - List - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/list/index.ts b/packages/ui-mobile/src/list/index.ts deleted file mode 100644 index ac1027cc8..000000000 --- a/packages/ui-mobile/src/list/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { List } from "react-native-paper"; diff --git a/packages/ui-mobile/src/loading/index.test.tsx b/packages/ui-mobile/src/loading/index.test.tsx deleted file mode 100644 index 59205911d..000000000 --- a/packages/ui-mobile/src/loading/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { DZCodeLoading } from "."; - -describe("DZCodeLoading", () => { - it("should render", () => { - const { container } = render(); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/loading/index.tsx b/packages/ui-mobile/src/loading/index.tsx deleted file mode 100644 index 6b7d1a8af..000000000 --- a/packages/ui-mobile/src/loading/index.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { FC, useEffect, useState } from "react"; -import { Animated, ImageStyle } from "react-native"; - -import { dzcodeLoadingStyles } from "./styles"; - -interface DZCodeLoadingProps { - /** - * the style of the dzcode.io logo - */ - style?: ImageStyle; -} -/** - * DZCodeLoading component used to display the dzcode.io loading logo in the app - * @example - * - * @see https://reactnative.dev/docs/image#style - */ - -export const DZCodeLoading: FC = ({ style }: DZCodeLoadingProps) => { - const [rotateAnimValue, setRotateAnimValue] = useState(new Animated.Value(0)); - - useEffect(() => { - Animated.loop( - Animated.spring(rotateAnimValue, { - toValue: 1, - friction: 5, - useNativeDriver: true, - }), - ).start(() => { - setRotateAnimValue(new Animated.Value(0)); - }); - }, []); - - return ( - - ); -}; diff --git a/packages/ui-mobile/src/loading/styles.ts b/packages/ui-mobile/src/loading/styles.ts deleted file mode 100644 index a6ee64dab..000000000 --- a/packages/ui-mobile/src/loading/styles.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { StyleSheet } from "react-native"; -import { SMALL_LOGO_HEIGHT, SMALL_LOGO_WIDTH } from "src/_utils/constants"; - -export const dzcodeLoadingStyles = StyleSheet.create({ - imageView: { - width: SMALL_LOGO_WIDTH, - height: SMALL_LOGO_HEIGHT, - resizeMode: "contain", - }, -}); diff --git a/packages/ui-mobile/src/markdown/index.test.tsx b/packages/ui-mobile/src/markdown/index.test.tsx deleted file mode 100644 index d44876f42..000000000 --- a/packages/ui-mobile/src/markdown/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { Markdown } from "."; - -describe("Markdown", () => { - it("should render", () => { - const { container } = render(); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/markdown/index.tsx b/packages/ui-mobile/src/markdown/index.tsx deleted file mode 100644 index d6e249525..000000000 --- a/packages/ui-mobile/src/markdown/index.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import { Roboto_400Regular, Roboto_700Bold, useFonts } from "@expo-google-fonts/roboto"; -import { FC } from "react"; -import { View } from "react-native"; -import { default as MarkdownDisplay, MarkdownIt } from "react-native-markdown-display"; -import { useTheme } from "src/_hooks/use-theme"; -import { LARGE_MARGIN_SIZE } from "src/_utils/constants"; -import { DZCodeLoading } from "src/loading"; - -interface MarkdownProps { - /** - * the markdown content to display - */ - content: string; - /** - * the function to open the link - */ - onLinkPress?: (url: string) => void; -} - -/** - * Markdown component used to display markdown content - * @example - * Linking.openURL(url)} - * /> - */ -export const Markdown: FC = ({ content, onLinkPress }) => { - const [fontsLoaded] = useFonts({ - Roboto_400Regular, - Roboto_700Bold, - }); - const { colors } = useTheme(); - - if (!fontsLoaded) { - return ( - - - - ); - } else { - return ( - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-expect-error - { - onLinkPress?.(url); - return true; - }} - > - {content} - - ); - } -}; diff --git a/packages/ui-mobile/src/navigation/drawer-nav/index.test.tsx b/packages/ui-mobile/src/navigation/drawer-nav/index.test.tsx deleted file mode 100644 index 560f7b387..000000000 --- a/packages/ui-mobile/src/navigation/drawer-nav/index.test.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { NavigationContainer } from "@react-navigation/native"; -import { act, render } from "@testing-library/react-native"; -import { FC } from "react"; -import { View } from "react-native"; -import type { Route } from "src/_types/route"; - -import { DrawerNav } from "."; - -const Home: FC = () => ; - -const routes: Route[] = [ - { - name: "Home", - component: Home, - label: "Home", - title: "Home", - }, -]; - -describe("DrawerNav", () => { - it("should render", async () => { - const { container } = render( - - - , - ); - await act(async () => { - expect(container).toBeTruthy(); - }); - }); -}); diff --git a/packages/ui-mobile/src/navigation/drawer-nav/index.tsx b/packages/ui-mobile/src/navigation/drawer-nav/index.tsx deleted file mode 100644 index 1fd8bb6d8..000000000 --- a/packages/ui-mobile/src/navigation/drawer-nav/index.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { createDrawerNavigator, DrawerContentComponentProps } from "@react-navigation/drawer"; -import { DrawerHeaderProps } from "@react-navigation/drawer/lib/typescript/src/types"; -import { FC } from "react"; -import type { Route } from "src/_types/route"; - -const { Navigator, Screen } = createDrawerNavigator(); - -interface DrawerNavProps { - /** - * the routes of the drawer navigation - */ - routes: Route[]; - /** - * the initial route name of the drawer navigation - */ - initialRouteName?: string; - /** - * the header of the drawer navigation - */ - header?: (props: DrawerHeaderProps) => React.ReactNode; - /** - * the drawer content of the drawer navigation - */ - drawerContent?: (props: DrawerContentComponentProps) => React.ReactNode; -} - -/** - * DrawerNav component used to create a drawer navigation - * @example - * ( - * name === props.scene.route.name)?.title || ""} - * openDrawer={() => props.scene.descriptor.navigation.dispatch(DrawerActions.openDrawer())} - * /> - * )} - * drawerContent={(props) => } - * /> - * @see https://reactnavigation.org/docs/drawer-navigator/ - */ -export const DrawerNav: FC = ({ - routes, - initialRouteName, - header, - drawerContent, -}) => { - return ( - - {routes.map(({ name, component, label }) => ( - - ))} - - ); -}; diff --git a/packages/ui-mobile/src/navigation/navigation-container/index.test.tsx b/packages/ui-mobile/src/navigation/navigation-container/index.test.tsx deleted file mode 100644 index b33bc6917..000000000 --- a/packages/ui-mobile/src/navigation/navigation-container/index.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { Text } from "react-native"; - -import { NavigationContainer } from "."; - -describe("NavigationContainer", () => { - it("should render", () => { - const { container } = render( - - Test - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/navigation/navigation-container/index.ts b/packages/ui-mobile/src/navigation/navigation-container/index.ts deleted file mode 100644 index 95e3d2dd0..000000000 --- a/packages/ui-mobile/src/navigation/navigation-container/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { NavigationContainer } from "@react-navigation/native"; diff --git a/packages/ui-mobile/src/navigation/stack-nav/index.test.tsx b/packages/ui-mobile/src/navigation/stack-nav/index.test.tsx deleted file mode 100644 index 035a74027..000000000 --- a/packages/ui-mobile/src/navigation/stack-nav/index.test.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { NavigationContainer } from "@react-navigation/native"; -import { act, render } from "@testing-library/react-native"; -import { FC } from "react"; -import { View } from "react-native"; -import type { Route } from "src/_types/route"; - -import { StackNav } from "."; - -const Home: FC = () => ; - -const routes: Route[] = [ - { - name: "Home", - component: Home, - label: "Home", - title: "Home", - }, -]; - -describe("StackNav", () => { - it("should render", async () => { - const { container } = render( - - - , - ); - await act(async () => { - expect(container).toBeTruthy(); - }); - }); -}); diff --git a/packages/ui-mobile/src/navigation/stack-nav/index.tsx b/packages/ui-mobile/src/navigation/stack-nav/index.tsx deleted file mode 100644 index cc38552e7..000000000 --- a/packages/ui-mobile/src/navigation/stack-nav/index.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { createStackNavigator } from "@react-navigation/stack"; -import { FC } from "react"; -import type { Route } from "src/_types/route"; - -const { Navigator, Screen } = createStackNavigator(); - -interface StackNavProps { - /** - * the routes of the stack navigation - */ - routes: Route[]; - /** - * the initial route name of the stack navigation - */ - initialRouteName?: string; -} - -/** - * StackNav component used to create a stack navigation - * @example - * - * @see https://reactnavigation.org/docs/stack-navigator/ - */ -export const StackNav: FC = ({ routes, initialRouteName }) => { - return ( - null }}> - {routes.map(({ name, component, label }) => ( - - ))} - - ); -}; diff --git a/packages/ui-mobile/src/text/paragraph/index.test.tsx b/packages/ui-mobile/src/text/paragraph/index.test.tsx deleted file mode 100644 index fa43dcf7a..000000000 --- a/packages/ui-mobile/src/text/paragraph/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { Paragraph } from "."; - -describe("Paragraph", () => { - it("should render", () => { - const { container } = render(Text); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/text/paragraph/index.ts b/packages/ui-mobile/src/text/paragraph/index.ts deleted file mode 100644 index 616ca7a5b..000000000 --- a/packages/ui-mobile/src/text/paragraph/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Paragraph } from "react-native-paper"; diff --git a/packages/ui-mobile/src/text/text/index.test.tsx b/packages/ui-mobile/src/text/text/index.test.tsx deleted file mode 100644 index a80b324a7..000000000 --- a/packages/ui-mobile/src/text/text/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { Text } from "."; - -describe("Text", () => { - it("should render", () => { - const { container } = render(Text); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/text/text/index.ts b/packages/ui-mobile/src/text/text/index.ts deleted file mode 100644 index 2df09a2dd..000000000 --- a/packages/ui-mobile/src/text/text/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Text } from "react-native-paper"; diff --git a/packages/ui-mobile/src/text/title/index.test.tsx b/packages/ui-mobile/src/text/title/index.test.tsx deleted file mode 100644 index bc5d22b00..000000000 --- a/packages/ui-mobile/src/text/title/index.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { Title } from "."; - -describe("Title", () => { - it("should render", () => { - const { container } = render(Text); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/text/title/index.ts b/packages/ui-mobile/src/text/title/index.ts deleted file mode 100644 index 1d7b73605..000000000 --- a/packages/ui-mobile/src/text/title/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Title } from "react-native-paper"; diff --git a/packages/ui-mobile/src/theme/index.ts b/packages/ui-mobile/src/theme/index.ts deleted file mode 100644 index 52cd4f776..000000000 --- a/packages/ui-mobile/src/theme/index.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { - DarkTheme as NavigationDarkTheme, - DefaultTheme as NavigationDefaultTheme, -} from "@react-navigation/native"; -import { - DefaultTheme as PaperDefaultTheme, - MD3DarkTheme as PaperDarkTheme, -} from "react-native-paper"; -import { Colors } from "src/theme/style/color"; - -// define combined default theme -const CombinedDefaultTheme = { - ...PaperDefaultTheme, - ...NavigationDefaultTheme, - colors: { - ...PaperDefaultTheme.colors, - ...NavigationDefaultTheme.colors, - }, -}; - -// define combined dark theme -const CombinedDarkTheme = { - ...PaperDarkTheme, - ...NavigationDarkTheme, - colors: { - ...PaperDarkTheme.colors, - ...NavigationDarkTheme.colors, - background: Colors.black, - }, -}; - -/** - * default theme for the app - * @see https://callstack.github.io/react-native-paper/theming.html - * @see https://reactnavigation.org/docs/themes/ - */ -export const defaultTheme = { - ...CombinedDefaultTheme, - colors: { - ...CombinedDefaultTheme.colors, - primary: Colors.primary, - accent: Colors.accent, - }, -}; - -/** - * dark theme for the app - * @see https://callstack.github.io/react-native-paper/theming.html - * @see https://reactnavigation.org/docs/themes/ - */ -export const darkTheme = { - ...CombinedDarkTheme, - colors: { - ...CombinedDarkTheme.colors, - primary: Colors.primary, - accent: Colors.accent, - }, -}; diff --git a/packages/ui-mobile/src/theme/style/color.ts b/packages/ui-mobile/src/theme/style/color.ts deleted file mode 100644 index f340dab43..000000000 --- a/packages/ui-mobile/src/theme/style/color.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Colors used in the app - */ -export const Colors = { - primary: "#43a047", - accent: "#50C255", - white: "#fff", - light: "#fff", - black: "#000", - dark: "#282c34", - grey: "#757575", - darkGrey: "#1d1d1d", - violet: "#a371f7", -}; diff --git a/packages/ui-mobile/src/theme/theme-provider/index.test.tsx b/packages/ui-mobile/src/theme/theme-provider/index.test.tsx deleted file mode 100644 index e7f298c33..000000000 --- a/packages/ui-mobile/src/theme/theme-provider/index.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { render } from "@testing-library/react-native"; -import { Text } from "react-native"; - -import { ThemeProvider } from "."; - -describe("ThemeProvider", () => { - it("should render", () => { - const { container } = render( - - Hello - , - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/theme/theme-provider/index.ts b/packages/ui-mobile/src/theme/theme-provider/index.ts deleted file mode 100644 index c38e7e2d7..000000000 --- a/packages/ui-mobile/src/theme/theme-provider/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Provider as ThemeProvider } from "react-native-paper"; diff --git a/packages/ui-mobile/src/try-again/index.test.tsx b/packages/ui-mobile/src/try-again/index.test.tsx deleted file mode 100644 index f81e57a9d..000000000 --- a/packages/ui-mobile/src/try-again/index.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { render } from "@testing-library/react-native"; - -import { TryAgain } from "."; - -describe("TryAgain", () => { - it("should render", () => { - const { container } = render( - console.log("do something")} - />, - ); - expect(container).toBeTruthy(); - }); -}); diff --git a/packages/ui-mobile/src/try-again/index.tsx b/packages/ui-mobile/src/try-again/index.tsx deleted file mode 100644 index a9a06982d..000000000 --- a/packages/ui-mobile/src/try-again/index.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { FC } from "react"; -import { View } from "react-native"; -import { Button, Headline } from "react-native-paper"; - -interface TryAgainProps { - /** - * the function to call when the button is clicked - */ - onClick: () => void; - /** - * the error message to display - */ - error: string; - /** - * the action to display on the button - */ - action: string; -} - -/** - * TryAgain component used to display a button to try again when an error is caught - * @example - * {}} - * error="Ops, something broke, we're checking on our end..." - * action="Try again" - * /> - */ -export const TryAgain: FC = ({ error, action, onClick }) => { - return ( - - {error} - - - ); -}; diff --git a/packages/ui-mobile/tsconfig.json b/packages/ui-mobile/tsconfig.json deleted file mode 100644 index 5a6dd7979..000000000 --- a/packages/ui-mobile/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "@dzcode.io/tooling/tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "baseUrl": "." - }, - "include": ["src", "jest.config.js"] -} diff --git a/web/src/components/locale/dictionary.ts b/web/src/components/locale/dictionary.ts index d54b86db2..7432c0640 100644 --- a/web/src/components/locale/dictionary.ts +++ b/web/src/components/locale/dictionary.ts @@ -26,10 +26,6 @@ export const dictionary = { "footer-category-link-text-projects": { en: "Projects", ar: "مشاريع" }, "footer-category-link-text-articles": { en: "Articles", ar: "مقالات" }, "footer-category-link-text-faq": { en: "FAQ", ar: "اسئلة / اجوبة" }, - "footer-category-title-mobile": { en: "Mobile", ar: "تطبيق جوال" }, - "footer-category-link-text-android": { en: "Android", ar: "أندرويد" }, - "footer-category-link-text-ios": { en: "iOS", ar: "ايفون" }, - "footer-category-link-text-expo": { en: "Expo", ar: "اكسبو" }, "footer-category-title-social-media": { en: "Social Media", ar: "وسائل التواصل الاجتماعي", @@ -187,14 +183,6 @@ Besides the open tasks on [/Contribute](/Contribute) page, you can also contribu en: "Make a Contribution", ar: "قدم مساهمة", }, - "landing-mobile-title": { - en: "Try the mobile app from AppStore or PlayStore", - ar: "جرب تطبيق الهاتف المحمول من AppStore أو PlayStore", - }, - "landing-mobile-subtitle": { - en: "Meet the DzCode i/o mobile app and stay up-to-date with the state of Algerian open-source software on iOS and Android.", - ar: "تعرف على تطبيق DzCode i / o للجوال وابق على اطلاع دائم بأحدث البرامج مفتوحة المصدر الجزائرية على iOS و Android.", - }, "landing-milestones-title": { en: "Project roadmap", ar: "خارطة طريق المشروع",