Skip to content

Commit

Permalink
Merge branch 'main' into update_buildcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
averyyip committed Dec 5, 2023
2 parents e381354 + 861872d commit f2e5d64
Show file tree
Hide file tree
Showing 55 changed files with 4,819 additions and 3,923 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Sync Staging to Main Branch

on:
push:
branches: [main]

permissions:
contents: write

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Update Staging Branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git checkout main
git fetch origin
git checkout staging
git pull
git merge origin/main
git push origin staging
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ dist
.vercel
.expo
.vscode
expo-env.d.ts
ios
android
8 changes: 4 additions & 4 deletions apps/backend/src/functions/alert-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ const alertPage = async ({ args, services }: Props<Args, Services>) => {
{ alertId: alert.id, userId: currentStep.userId },
'Alert user',
);
} else if (currentStep.type === 'ROTATION') {
// TODO: Add logic to look up the user associated with the rotation and page
} else if (currentStep.type === 'SCHEDULE') {
// TODO: Add logic to look up the user associated with the schedule
logger.info(
{ alertId: alert.id, rotationId: currentStep.rotationId },
'Alert rotation',
{ alertId: alert.id, scheduleId: currentStep.scheduleId },
'Alert schedule',
);
}

Expand Down
16 changes: 11 additions & 5 deletions apps/expo/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
import type { ExpoConfig } from '@expo/config';

const defineConfig = (): ExpoConfig => ({
owner: 'vessel',
name: 'Pager',
slug: 'pager',
slug: 'vessel',
scheme: 'expo',
version: '0.1.0',
orientation: 'portrait',
icon: './assets/icon.jpg',
icon: './assets/icon.png',
userInterfaceStyle: 'light',
splash: {
image: './assets/icon.jpg',
image: './assets/icon.png',
resizeMode: 'contain',
backgroundColor: '#171717',
},
updates: {
fallbackToCacheTimeout: 0,
url: 'https://u.expo.dev/d90f23a9-bbca-450d-abca-0b42c78c9353',
},
assetBundlePatterns: ['**/*'],
ios: {
bundleIdentifier: 'your.bundle.identifier',
bundleIdentifier: 'com.vessel.pager',
supportsTablet: true,
},
android: {
package: 'com.vessel.pager',
adaptiveIcon: {
foregroundImage: './assets/icon.jpg',
foregroundImage: './assets/icon.png',
backgroundColor: '#1F104A',
},
googleServicesFile: './google-services.json',
},
extra: {
/**
Expand All @@ -40,6 +43,9 @@ const defineConfig = (): ExpoConfig => ({
tsconfigPaths: true,
typedRoutes: true,
},
runtimeVersion: {
policy: 'appVersion',
},
plugins: ['expo-router', './expo-plugins/with-modify-gradle.js'],
});

Expand Down
Binary file removed apps/expo/assets/icon.jpg
Binary file not shown.
Binary file added apps/expo/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 21 additions & 4 deletions apps/expo/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,34 @@
"development": {
"extends": "base",
"developmentClient": true,
"distribution": "internal"
"distribution": "internal",
"env": {
"EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY": "pk_test_bWFqb3ItZmxvdW5kZXItMTUuY2xlcmsuYWNjb3VudHMuZGV2JA",
"EXPO_PUBLIC_WEBAPP_URL": "https://pager.staging.vessel.dev"
}
},
"development-simulator": {
"extends": "development",
"ios": {
"simulator": true
}
},
"preview": {
"extends": "base",
"channel": "preview",
"distribution": "internal",
"ios": {
"simulator": true
"env": {
"EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY": "pk_test_bWFqb3ItZmxvdW5kZXItMTUuY2xlcmsuYWNjb3VudHMuZGV2JA",
"EXPO_PUBLIC_WEBAPP_URL": "https://pager.staging.vessel.dev"
}
},
"production": {
"extends": "base"
"extends": "base",
"channel": "production",
"env": {
"EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY": "pk_live_Y2xlcmsudmVzc2VsLmRldiQ",
"EXPO_PUBLIC_WEBAPP_URL": "https://pager.vessel.dev"
}
}
},
"submit": {
Expand Down
29 changes: 29 additions & 0 deletions apps/expo/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "861551563613",
"project_id": "vessel-f2624",
"storage_bucket": "vessel-f2624.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:861551563613:android:73a9441fe09d26ab038eb4",
"android_client_info": {
"package_name": "com.vessel.pager"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBqiNT0SVPZiiabtznYgOrApiIdWzhTmr8"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}
15 changes: 9 additions & 6 deletions apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"main": "expo-router/entry",
"scripts": {
"clean": "git clean -xdf .expo .turbo node_modules",
"dev:mobile": "expo start --ios",
"dev:mobile": "pnpm with-env expo start --ios",
"dev:android": "expo start --android",
"dev:ios": "expo start --ios",
"lint": "eslint .",
"format": "prettier --check \"**/*.{js,cjs,mjs,ts,tsx,md,json}\"",
"typecheck": "tsc --noEmit",
"android": "expo run:android",
"ios": "expo run:ios"
"ios": "expo run:ios",
"with-env": "cp ../../.env .env && "
},
"dependencies": {
"@clerk/clerk-expo": "^0.19.21",
Expand All @@ -23,17 +24,19 @@
"@trpc/react-query": "next",
"@trpc/server": "next",
"date-fns": "^2.30.0",
"expo": "^49.0.16",
"expo-auth-session": "^5.2.0",
"expo": "^49.0.21",
"expo-auth-session": "^5.0.2",
"expo-constants": "~14.4.2",
"expo-dev-client": "~2.4.12",
"expo-device": "~5.4.0",
"expo-linking": "~5.0.2",
"expo-notifications": "~0.20.1",
"expo-router": "2.0.11",
"expo-secure-store": "^12.5.0",
"expo-secure-store": "^12.3.1",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "^1.6.0",
"expo-web-browser": "^12.5.0",
"expo-updates": "~0.18.17",
"expo-web-browser": "^12.3.2",
"nativewind": "^4.0.13",
"radash": "^11.0.0",
"react": "18.2.0",
Expand Down
27 changes: 26 additions & 1 deletion apps/expo/src/app/(auth)/SignInWithOAuth.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useOAuth } from '@clerk/clerk-expo';
import { useOAuth, useSignIn } from '@clerk/clerk-expo';
import { FontAwesome } from '@expo/vector-icons';
import * as WebBrowser from 'expo-web-browser';
import React from 'react';
Expand All @@ -14,6 +14,7 @@ const SignInWithOAuth = () => {
// Warm up the android browser to improve UX
// https://docs.expo.dev/guides/authentication/#improving-user-experience
useWarmUpBrowser();
const { signIn, setActive, isLoaded } = useSignIn();

const { startOAuthFlow: startOAuthFlowGoogle } = useOAuth({
strategy: 'oauth_google',
Expand Down Expand Up @@ -42,6 +43,23 @@ const SignInWithOAuth = () => {
}
}, [startFlow]);

const onSignInPress = async () => {
if (!isLoaded) {
return;
}
try {
const completeSignIn = await signIn.create({
identifier: '[email protected]',
password: 'vesselguest',
});
// This is an important step,
// This indicates the user is signed in
await setActive({ session: completeSignIn.createdSessionId });
} catch (err: any) {
console.log(err);
}
};

return (
<SafeAreaView>
<View className="h-full w-full p-4 bg-[#181818] flex-col justify-center">
Expand Down Expand Up @@ -77,6 +95,13 @@ const SignInWithOAuth = () => {
</View>
</TouchableOpacity>
</View>
<View className="p-4 mb-4">
<TouchableOpacity onPress={onSignInPress}>
<View className="w-full flex-row items-center justify-center">
<Text className="text-xl text-slate-200">Continue as guest</Text>
</View>
</TouchableOpacity>
</View>
</View>
</SafeAreaView>
);
Expand Down
78 changes: 43 additions & 35 deletions apps/expo/src/app/(tabs)/(alerts)/_components/AlertListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ const AlertListItem = ({
onReopen: () => void;
onSelfAssign: () => void;
}) => {
const { status, title, createdAt } = alert;
const { firstName, lastName } = user;
const { status, title, createdAt, summary } = alert;
const initials =
(user.firstName?.slice(0, 1) ?? '') + (user.lastName?.slice(0, 1) ?? '');

const StatusColors = StatusToColor[status as keyof typeof StatusToColor];
const { LeftSwipe, RightSwipe, action } = createSwipeAnimations(status, {
Expand All @@ -44,46 +45,53 @@ const AlertListItem = ({
>
<Animated.View className="pb-8 px-4 pt-2 bg-white">
<View className={'flex-row justify-between'}>
<View className={'flex-row items-center'}>
<View
className={`mr-4 w-[60px] rounded bg-opacity-80 py-0.5 ${StatusColors.view}`}
>
<View className="flex-row">
<View className={'flex-row items-center'}>
<View
className={`mr-4 w-[60px] rounded bg-opacity-80 py-0.5 ${StatusColors.view}`}
>
<Text
className={`text-center text-sm font-medium capitalize ${StatusColors.text}`}
>
{status}
</Text>
</View>
</View>

<View>
<Text
className={`text-center text-sm font-medium capitalize ${StatusColors.text}`}
className={'mb-1.5 mr-2 text-lg font-medium w-[190px]'}
numberOfLines={1}
>
{status}
{title}
</Text>
<Text
numberOfLines={2}
className={'w-[190px] text-sm text-gray-500'}
>
{summary}
</Text>
</View>
</View>

<View>
<Text
className={'mb-1.5 mr-2 text-lg font-medium w-[220px]'}
numberOfLines={1}
>
{title}
</Text>
<Text
className={
'w-[65%] text-sm text-gray-500 overflow-ellipsis overflow-hidden'
}
>
Occaeacat sint aute nulla proident nulla proident nulla proident
nulla proident....
</Text>
</View>
</View>
<View className={'absolute right-0 top-3 flex-row items-center '}>
<Text className={'mr-4 text-sm'}>{format(createdAt, 'dd/MM p')}</Text>
</View>
<View className="flex justify-between items-end mr-2">
<View className={'flex-row items-center'}>
<Text className={'text-sm'}>{format(createdAt, 'dd/MM p')}</Text>
</View>

<View className={'absolute bottom-4 right-2 flex-row items-center '}>
<Text className={'mr-1 text-sm font-bold text-gray-600'}>
{(firstName?.slice(0, 1) ?? '') + (lastName?.slice(0, 1) ?? '')}
</Text>
<TouchableOpacity onPress={onSelfAssign}>
<Ionicons name="md-hand-right-outline" size={22} color="black" />
</TouchableOpacity>
<View className={'flex-row items-center '}>
<Text className={'mr-1 text-sm font-bold text-gray-600'}>
{initials}
</Text>
<TouchableOpacity onPress={onSelfAssign}>
<Ionicons
name="md-hand-right-outline"
size={22}
color="black"
/>
</TouchableOpacity>
</View>
</View>
</View>
</Animated.View>
</Swipeable>
Expand Down
2 changes: 1 addition & 1 deletion apps/expo/src/app/(tabs)/(alerts)/alerts.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RouterOutputs } from '@vessel/api';

export type Alert = RouterOutputs['alert']['all']['0'];
export type Alert = NonNullable<RouterOutputs['alert']['all']['0']>;
export type User = RouterOutputs['user']['me']['user'];
1 change: 1 addition & 0 deletions apps/expo/src/app/(tabs)/(alerts)/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const AlertListPage = () => {
) : (
<FlatList
data={alerts.data}
contentContainerStyle={{ paddingBottom: 300 }}
renderItem={({ item }) => (
<AlertListItem
alert={item}
Expand Down
5 changes: 1 addition & 4 deletions apps/expo/src/utils/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ const getBaseUrl = () => {
const localhost = debuggerHost?.split(':')[0];

if (!localhost) {
// return "https://turbo.t3.gg";
throw new Error(
'Failed to get localhost. Please point to your production server.',
);
return process.env.EXPO_PUBLIC_WEBAPP_URL;
}
return `http://${localhost}:3000`;
};
Expand Down
Loading

0 comments on commit f2e5d64

Please sign in to comment.