Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: PR Preview

on:
pull_request:
types: [opened, reopened, synchronize, closed]

permissions:
contents: write
deployments: read
pull-requests: write

concurrency:
group: pr-preview-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
deploy-preview:
name: Deploy web preview
if: github.event.pull_request.head.repo.full_name == github.repository

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Do not unconditionally skip fork PRs if previews are meant for contributor PRs. This condition evaluates false for this PR (gac0812/Tfgxs), so the preview job is skipped entirely and no URL/QR comment is published. A fork-safe design needs to build without write credentials and perform the Pages update in a trusted follow-up job, or the preview contract should explicitly document that fork PRs are unsupported.

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.action == 'closed' && github.event.pull_request.base.sha || github.event.pull_request.head.sha }}

- name: Set up Node.js
if: github.event.action != 'closed'
uses: actions/setup-node@v4
with:
node-version: 20.20.2
cache: npm
cache-dependency-path: frontend/package-lock.json

- name: Install frontend dependencies
if: github.event.action != 'closed'
working-directory: frontend
run: npm ci

- name: Export interactive web preview
if: github.event.action != 'closed'
working-directory: frontend
env:
EXPO_PUBLIC_USE_FAKE_WS: 'true'
EXPO_PUBLIC_WS_URL: ''
TIMEFLOW_PREVIEW_BASE_URL: /${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.number }}
run: npx expo export --platform web --dev --output-dir dist

- name: Deploy preview and comment on PR
uses: rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1.8.1
with:
source-dir: frontend/dist
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
wait-for-pages-deployment: true
comment: true
qr-code: true
16 changes: 14 additions & 2 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# Android emulator: 10.0.2.2 reaches the host machine.
EXPO_PUBLIC_API_URL=http://10.0.2.2:8000/api/v1
# Baidu Maps browser-side AK with JavaScript API enabled.
# Allow localhost for web development and https://timeflow.local/* for the native WebView.
EXPO_PUBLIC_BAIDU_MAP_AK=replace-with-your-baidu-map-ak

# Real backend WebSocket URL (required for release / production builds).
# The client appends its persisted device_id query parameter automatically.
# Local device example: ws://192.168.1.10:8000/ws
# Production example: wss://api.example.com/ws
EXPO_PUBLIC_WS_URL=

# Use in-process FakeWsServer when EXPO_PUBLIC_WS_URL is empty.
# In __DEV__, Fake is allowed by default if this is unset.
# Release builds always ignore this flag and fail fast without a URL.
# EXPO_PUBLIC_USE_FAKE_WS=true
55 changes: 48 additions & 7 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/
expo-env.d.ts

# Metro
.metro-health-check*

# Native signing
# Native
.kotlin/
*.orig.*
*.jks
Expand All @@ -15,8 +18,46 @@ expo-env.d.ts
*.key
*.mobileprovision

# generated native folders
# Leading slash keeps these to this directory only — a bare `android/` would
# match a directory of that name at any depth.
# Metro
.metro-health-check*

# debug
*.log
npm-debug.*
yarn-debug.*
yarn-error.*

# test coverage
coverage/

# macOS / Windows
.DS_Store
Thumbs.db
*.pem

# IDE
.idea/
.vscode/
*.swp
*.swo

# local env files
.env*.local
.env
!.env.example

# typescript
*.tsbuildinfo

# generated native folders — the repo root does not cover these
# Leading slash is required: a bare `android/` matches a directory of that
# name at any depth, not just the prebuild output sitting here.
/ios
/android

# local build artifacts & previews
*.apk
alarm-ring-preview.html

# local source backups
_backup*
15 changes: 13 additions & 2 deletions frontend/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { HomeScreen } from './src/screens/HomeScreen';
import { AppRoot } from '@/app/AppRoot';
import { AppProviders } from '@/app/providers';
import { useAlarmPermissionsOnLaunch } from '@/features/reminder';

function Root() {
useAlarmPermissionsOnLaunch();
return <AppRoot />;
}

export default function App() {
return <HomeScreen />;
return (
<AppProviders>
<Root />
</AppProviders>
);
}
Loading
Loading