-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into timetable-ux
- Loading branch information
Showing
33 changed files
with
934 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
EXPO_PUBLIC_ENVIRONMENT=development | ||
EXPO_PUBLIC_API_URL=https://yusf31nx11.execute-api.eu-west-1.amazonaws.com/staging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Typecheck, lint, format and test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint-typecheck: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Typecheck | ||
run: npm run check:types | ||
|
||
- name: Lint | ||
run: npm run check:lint | ||
|
||
- name: Format | ||
run: npm run check:format | ||
|
||
- name: Test | ||
run: npm run check:test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,9 @@ npm-debug.* | |
web-build/ | ||
.env | ||
|
||
# Test stuff | ||
coverage/ | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export class StatusError extends Error { | ||
constructor( | ||
public message: string, | ||
public statusCode: number | ||
) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { StatusError } from './errors'; | ||
|
||
export interface ProfileData { | ||
id: number; | ||
email: string; | ||
phone?: string; | ||
created_at: string; | ||
first_name?: string; | ||
last_name?: string; | ||
status: number; | ||
verified_at?: string; | ||
extra: unknown; | ||
username?: string; | ||
user_level: number; | ||
is_banned: boolean; | ||
profile_preferences: ProfilePreferences; | ||
telia_linked_at?: string; | ||
marketing_box_granted: boolean; | ||
region: string; | ||
opened_lootboxes_count: number; | ||
balance: number; | ||
social_login: boolean; | ||
} | ||
|
||
interface ProfilePreferences { | ||
coins: boolean; | ||
realName: boolean; | ||
memberSince: boolean; | ||
shoutTrophy: boolean; | ||
questionTrophy: boolean; | ||
allowShowUsername: boolean; | ||
openedLootboxesCount: boolean; | ||
} | ||
|
||
const opts = (token?: string, body?: unknown) => ({ | ||
method: 'POST', | ||
headers: token | ||
? { Authorization: 'Bearer ' + token, 'content-type': 'application/json' } | ||
: ({ 'content-type': 'application/json' } as any), | ||
body: body ? JSON.stringify(body) : undefined, | ||
}); | ||
|
||
export async function fetchProfile(token: string) { | ||
const url = `${process.env.EXPO_PUBLIC_API_URL}/auth/jwt`; | ||
|
||
const response = await fetch(url, opts(token)); | ||
const data = await response.json(); | ||
console.log(data); | ||
return data as ProfileData; | ||
} | ||
|
||
export async function signupRequest(email: string, password: string) { | ||
const url = `${process.env.EXPO_PUBLIC_API_URL}/person/signup`; | ||
|
||
const response = await fetch(url, opts(undefined, { email, password, region: 'asm' })); | ||
if (!response.ok) { | ||
throw new StatusError('signup-failed', response.status); | ||
} | ||
const data = await response.json(); | ||
return { | ||
profile: data as ProfileData, | ||
token: response.headers.get('x-auth-token')!, | ||
}; | ||
} | ||
|
||
export async function loginRequest(login: string, password: string) { | ||
const url = `${process.env.EXPO_PUBLIC_API_URL}/auth/local?region=asm`; | ||
|
||
const response = await fetch(url, opts(undefined, { login, password })); | ||
if (!response.ok) { | ||
throw new StatusError('login-failed', response.status); | ||
} | ||
const data = await response.json(); | ||
console.log(data); | ||
return { | ||
profile: data as ProfileData, | ||
token: response.headers.get('x-auth-token')!, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
export default () => { | ||
return { | ||
expo: { | ||
name: 'Assembly', | ||
slug: 'assembly-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: '#191919', | ||
}, | ||
ios: { | ||
supportsTablet: true, | ||
bundleIdentifier: | ||
process.env.EXPO_PUBLIC_ENVIRONMENT === 'production' | ||
? 'com.testausserveri.assemblyapp' | ||
: 'com.testausserveri.assemblyapp-dev', | ||
}, | ||
android: { | ||
adaptiveIcon: { | ||
foregroundImage: './assets/images/adaptive-icon.png', | ||
backgroundColor: '#191919', | ||
}, | ||
package: | ||
process.env.EXPO_PUBLIC_ENVIRONMENT === 'production' | ||
? 'com.testausserveri.assemblyapp' | ||
: 'com.testausserveri.assemblyapp-dev', | ||
}, | ||
web: { | ||
bundler: 'metro', | ||
output: 'static', | ||
favicon: './assets/images/favicon.png', | ||
}, | ||
plugins: ['expo-router', 'expo-build-properties'], | ||
experiments: { | ||
typedRoutes: true, | ||
}, | ||
extra: { | ||
router: { | ||
origin: false, | ||
}, | ||
eas: { | ||
projectId: '469c71b6-54c5-4111-bc4a-03e2cf92a23d', | ||
}, | ||
}, | ||
owner: 'testausserveri', | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import AppBar from '@/elements/AppBar'; | ||
import AboutWebview from '@/elements/about/AboutWebview'; | ||
import { Surface } from 'react-native-paper'; | ||
import { useTheme } from 'react-native-paper'; | ||
import { useSafeAreaInsets } from 'react-native-safe-area-context'; | ||
|
||
function AboutScreen() { | ||
const theme = useTheme(); | ||
const insets = useSafeAreaInsets(); | ||
|
||
return ( | ||
<Surface | ||
style={{ | ||
height: '100%', | ||
backgroundColor: theme.colors.background, | ||
paddingTop: insets.top, | ||
}} | ||
> | ||
<AppBar title='about' /> | ||
<AboutWebview /> | ||
</Surface> | ||
); | ||
} | ||
|
||
export default AboutScreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import AppBar from '@/elements/AppBar'; | ||
import EventMap from '@/elements/map/EventMap'; | ||
import { Surface } from 'react-native-paper'; | ||
import { useTheme } from 'react-native-paper'; | ||
import { useSafeAreaInsets } from 'react-native-safe-area-context'; | ||
|
||
export default function MapScreen() { | ||
const theme = useTheme(); | ||
const insets = useSafeAreaInsets(); | ||
|
||
return ( | ||
<Surface | ||
style={{ | ||
height: '100%', | ||
backgroundColor: theme.colors.background, | ||
paddingTop: insets.top, | ||
}} | ||
> | ||
<AppBar title='map' /> | ||
<EventMap /> | ||
</Surface> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import AppBar from '@/elements/AppBar'; | ||
import LanguageSelector from '@/elements/LanguageSelector'; | ||
import { Link } from 'expo-router'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { View } from 'react-native'; | ||
import { Surface, Text, useTheme } from 'react-native-paper'; | ||
import { useSafeAreaInsets } from 'react-native-safe-area-context'; | ||
|
||
export default function HomeScreen() { | ||
const { t } = useTranslation(); | ||
const theme = useTheme(); | ||
|
||
const insets = useSafeAreaInsets(); | ||
|
||
return ( | ||
<View | ||
style={{ | ||
flex: 1, | ||
alignItems: 'center', | ||
gap: 8, | ||
backgroundColor: theme.colors.background, | ||
paddingTop: insets.top, | ||
}} | ||
> | ||
<AppBar title={t('profile')} /> | ||
<View | ||
style={{ flex: 1, width: '100%', justifyContent: 'center', alignItems: 'center' }} | ||
> | ||
<LanguageSelector /> | ||
<Surface | ||
elevation={0} | ||
style={{ padding: 16, width: '100%', justifyContent: 'center', gap: 16 }} | ||
> | ||
<Text style={{ textAlign: 'center' }} variant='bodyLarge'> | ||
{t('working-on-this')} | ||
</Text> | ||
<Link | ||
style={{ | ||
color: theme.colors.primary, | ||
textDecorationLine: 'underline', | ||
textAlign: 'center', | ||
}} | ||
href='/credits' | ||
> | ||
{t('meanwhile')} | ||
</Link> | ||
</Surface> | ||
</View> | ||
|
||
{/** <ProfileView /> */} | ||
</View> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.