Skip to content

Commit

Permalink
Merge branch 'main' into api
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurin-Notemann committed Nov 16, 2024
2 parents f8589e7 + 2d8c557 commit 5a1e1ae
Show file tree
Hide file tree
Showing 99 changed files with 40,826 additions and 30,986 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'monthly'
groups:
patch-dependencies:
update-types:
- 'patch'

- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'monthly'
25 changes: 25 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

jobs:
format:
name: Assert code formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: cd mobile-app; npm install
- name: Run format check
run: cd mobile-app; npm run ci:format
6 changes: 6 additions & 0 deletions 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Merge remote-tracking branch 'origin/react-query-setup' into new-ui
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
4 changes: 4 additions & 0 deletions mobile-app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// https://docs.expo.dev/guides/using-eslint/
module.exports = {
extends: 'expo',
};
15 changes: 15 additions & 0 deletions mobile-app/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// eslint-disable-next-line
module.exports = {
semi: true,
singleQuote: true,
trailingComma: 'es5',
printWidth: 80,
tabWidth: 4,
useTabs: false,
plugins: ['@trivago/prettier-plugin-sort-imports'],
importOrder: ['<THIRD_PARTY_MODULES>', '^@/(.*)$', '^[./]'],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
importOrderGroupNamespaceSpecifiers: true,
importOrderCaseInsensitive: true,
};
28 changes: 14 additions & 14 deletions mobile-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ This is an [Expo](https://expo.dev) project created with [`create-expo-app`](htt

1. Install dependencies

```bash
npm install
```
```bash
npm install
```

2. Start the app

```bash
npx expo start
```
```bash
npx expo start
```

In the output, you'll find options to open the app in a
- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
Expand All @@ -39,12 +39,12 @@ This command will move the starter code to the **app-example** directory and cre

To learn more about developing your project with Expo, look at the following resources:

- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
## Join the community
Join our community of developers creating universal apps.
- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
18 changes: 18 additions & 0 deletions mobile-app/api/calls/group/groupHooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useQuery } from 'react-query';

import { ApiId } from '@/api/types';
import { createApi } from '@/api/utils/create-api';

interface IGroup {
id: ApiId;
name: string;
}

export const useGroup = (id: ApiId) => {
const api = createApi();

return useQuery<IGroup>(['group', id], async () => {
const { data } = await api.get(`/groups/${id}`);
return data;
});
};
23 changes: 23 additions & 0 deletions mobile-app/api/hooks/groupHooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { GroupSettingsProps } from '@/components/screens/GroupSettings';

import { useGroup } from '../calls/group/groupHooks';
import { ApiId } from '../types';

export const useGroupSettingsProps = (groupId: ApiId) => {
const { data, ...props } = useGroup(groupId);

const groupPageProps: GroupSettingsProps | null = data
? {
groupName: data.name,
hasPremium: false,
pastSeasons: 0,
pushNotificationsEnabled: true,
groupCode: '123456',
}
: null;

return {
props: groupPageProps,
...props,
};
};
1 change: 1 addition & 0 deletions mobile-app/api/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type ApiId = string;
Empty file added mobile-app/api/utils/client.ts
Empty file.
14 changes: 14 additions & 0 deletions mobile-app/api/utils/create-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import axios from 'axios';

// Might make sense to make a hook for this if we implment tokens and add a interceptor

export const createApi = () => {
const api = axios.create({
baseURL: process.env.API_BASE_URL,
headers: {
'Content-Type': 'application/json',
},
});

return api;
};
21 changes: 21 additions & 0 deletions mobile-app/api/utils/query-client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { QueryClient } from 'react-query';

import { minutes } from '@/utils/time';

// --- QUERY CLIENT ---

export const createQueryClient = () => {
const qc = new QueryClient();

qc.setDefaultOptions({
queries: {
staleTime: minutes(2),
retry: false,
},
mutations: {
retry: false,
},
});

return qc;
};
80 changes: 40 additions & 40 deletions mobile-app/app.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
{
"expo": {
"name": "mobile-app",
"slug": "mobile-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
"userInterfaceStyle": "automatic",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.linusbolls.mobileapp",
"expo": {
"name": "mobile-app",
"slug": "mobile-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
"userInterfaceStyle": "automatic",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.linusbolls.mobileapp",

"infoPlist": {
"NSPhotoLibraryUsageDescription": true
}
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"web": {
"bundler": "metro",
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"plugins": ["expo-router"],
"experiments": {
"typedRoutes": true
},
"extra": {
"eas": {
"projectId": "8dbfe974-43ce-4f4e-b3d8-cf6f77109412"
}
"infoPlist": {
"NSPhotoLibraryUsageDescription": true
}
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"web": {
"bundler": "metro",
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"plugins": ["expo-router"],
"experiments": {
"typedRoutes": true
},
"extra": {
"eas": {
"projectId": "8dbfe974-43ce-4f4e-b3d8-cf6f77109412"
}
}
}
}
}
Loading

0 comments on commit 5a1e1ae

Please sign in to comment.