@adelin-io/cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -2
- package/authoring-release.json +174 -0
- package/package.json +30 -4
- package/runtime-integrity.json +9 -0
- package/scripts/adelin.mjs +7768 -0
- package/scripts/assemble-checkout.mjs +93 -0
- package/scripts/local-save.mjs +513 -0
- package/scripts/materialize.mjs +319 -0
- package/scripts/runtime.mjs +8950 -0
- package/scripts/typecheck.mjs +72 -0
- package/scripts/workspace-state.mjs +183 -0
- package/skill/README.md +77 -0
- package/skill/SKILL.md +100 -0
- package/skill/authoring/access.md +193 -0
- package/skill/authoring/analytics.md +20 -0
- package/skill/authoring/app-memory.md +128 -0
- package/skill/authoring/app-requirements.md +99 -0
- package/skill/authoring/app-structure.md +265 -0
- package/skill/authoring/assets.md +117 -0
- package/skill/authoring/auth.md +261 -0
- package/skill/authoring/content-binding.md +26 -0
- package/skill/authoring/i18n.md +184 -0
- package/skill/authoring/language.md +503 -0
- package/skill/authoring/local-workflow.md +1665 -0
- package/skill/authoring/offline/connectivity.md +50 -0
- package/skill/authoring/offline/example.md +102 -0
- package/skill/authoring/offline/history-sync.md +39 -0
- package/skill/authoring/offline/index.md +29 -0
- package/skill/authoring/offline/package-storage.md +37 -0
- package/skill/authoring/offline/platforms.md +35 -0
- package/skill/authoring/offline/startup-navigation.md +53 -0
- package/skill/authoring/platform-files.md +616 -0
- package/skill/authoring/player/casting.md +47 -0
- package/skill/authoring/player/controls.md +95 -0
- package/skill/authoring/player/downloads.md +90 -0
- package/skill/authoring/player/drm.md +31 -0
- package/skill/authoring/player/index.md +39 -0
- package/skill/authoring/player/live-dvr.md +33 -0
- package/skill/authoring/player/platforms.md +47 -0
- package/skill/authoring/player/playback.md +42 -0
- package/skill/authoring/player/tracks-subtitles.md +32 -0
- package/skill/authoring/profiles.md +213 -0
- package/skill/authoring/remote-keys.md +139 -0
- package/skill/authoring/search.md +27 -0
- package/skill/authoring/store.md +85 -0
- package/skill/authoring/tv-text-entry.md +146 -0
- package/skill/design/approved/README.md +14 -0
- package/skill/design/approved/vesper-phone-home.jpg +0 -0
- package/skill/design/approved/vesper-tv-detail.jpg +0 -0
- package/skill/design/approved/vesper-tv-home.jpg +0 -0
- package/skill/design/design-guide.md +610 -0
- package/skill/design/edge-to-edge.md +66 -0
- package/skill/design/icons.md +50 -0
- package/skill/design/responsive-layout.md +175 -0
- package/skill/design/safe-area.md +221 -0
- package/skill/design/streaming-playbook.md +131 -0
- package/skill/design/visual-review.md +150 -0
- package/skill/examples/README.md +24 -0
- package/skill/examples/cinema/DESIGN.md +58 -0
- package/skill/examples/cinema/app.tsx +17 -0
- package/skill/examples/cinema/assets/logo.png +0 -0
- package/skill/examples/cinema/components/Action.tsx +40 -0
- package/skill/examples/cinema/components/Action.tv.tsx +44 -0
- package/skill/examples/cinema/components/CatalogGrid.tsx +31 -0
- package/skill/examples/cinema/components/ContinueRail.tsx +98 -0
- package/skill/examples/cinema/components/Feedback.tsx +28 -0
- package/skill/examples/cinema/components/Field.tsx +41 -0
- package/skill/examples/cinema/components/LibraryRail.tsx +46 -0
- package/skill/examples/cinema/components/PlayAction.tsx +29 -0
- package/skill/examples/cinema/components/Root.tsx +59 -0
- package/skill/examples/cinema/components/Shell.tsx +70 -0
- package/skill/examples/cinema/components/Tab.tsx +22 -0
- package/skill/examples/cinema/components/TitleCard.tsx +68 -0
- package/skill/examples/cinema/components/TitleMeta.tsx +36 -0
- package/skill/examples/cinema/locales/en.ts +211 -0
- package/skill/examples/cinema/locales/lt.ts +211 -0
- package/skill/examples/cinema/preview/phone-home.jpg +0 -0
- package/skill/examples/cinema/preview/tv-detail.jpg +0 -0
- package/skill/examples/cinema/preview/tv-home.jpg +0 -0
- package/skill/examples/cinema/screens/portrait/Account.tsx +110 -0
- package/skill/examples/cinema/screens/portrait/Browse.tsx +73 -0
- package/skill/examples/cinema/screens/portrait/Detail.tsx +159 -0
- package/skill/examples/cinema/screens/portrait/Home.tsx +196 -0
- package/skill/examples/cinema/screens/portrait/Player.tsx +299 -0
- package/skill/examples/cinema/screens/portrait/Search.tsx +46 -0
- package/skill/examples/cinema/screens/portrait/Search.tv.tsx +55 -0
- package/skill/examples/cinema/screens/portrait/SignIn.tsx +101 -0
- package/skill/examples/cinema/screens/portrait/SignUp.tsx +106 -0
- package/skill/examples/cinema/store.tsx +132 -0
- package/skill/examples/cinema/theme.ts +32 -0
- package/skill/examples/documentary/DESIGN.md +33 -0
- package/skill/examples/documentary/app.tsx +17 -0
- package/skill/examples/documentary/components/Action.tsx +43 -0
- package/skill/examples/documentary/components/CatalogGrid.tsx +47 -0
- package/skill/examples/documentary/components/Feedback.tsx +27 -0
- package/skill/examples/documentary/components/Field.tsx +33 -0
- package/skill/examples/documentary/components/LibraryRail.tsx +47 -0
- package/skill/examples/documentary/components/Root.tsx +62 -0
- package/skill/examples/documentary/components/Shell.tsx +93 -0
- package/skill/examples/documentary/components/StoryCard.tsx +53 -0
- package/skill/examples/documentary/components/StoryMeta.tsx +22 -0
- package/skill/examples/documentary/preview/phone-home.jpg +0 -0
- package/skill/examples/documentary/preview/tv-detail.jpg +0 -0
- package/skill/examples/documentary/preview/tv-home.jpg +0 -0
- package/skill/examples/documentary/screens/portrait/Account.tsx +97 -0
- package/skill/examples/documentary/screens/portrait/Browse.tsx +71 -0
- package/skill/examples/documentary/screens/portrait/Detail.tsx +133 -0
- package/skill/examples/documentary/screens/portrait/Home.tsx +89 -0
- package/skill/examples/documentary/screens/portrait/Player.tsx +116 -0
- package/skill/examples/documentary/screens/portrait/Search.tsx +48 -0
- package/skill/examples/documentary/screens/portrait/SignIn.tsx +96 -0
- package/skill/examples/documentary/screens/portrait/SignUp.tsx +101 -0
- package/skill/examples/documentary/store.tsx +115 -0
- package/skill/examples/documentary/theme.ts +20 -0
- package/skill/examples/series/DESIGN.md +55 -0
- package/skill/examples/series/app.tsx +17 -0
- package/skill/examples/series/components/Action.tsx +42 -0
- package/skill/examples/series/components/CatalogGrid.tsx +43 -0
- package/skill/examples/series/components/ContinueRail.tsx +78 -0
- package/skill/examples/series/components/Feedback.tsx +26 -0
- package/skill/examples/series/components/Field.tsx +34 -0
- package/skill/examples/series/components/LibraryRail.tsx +38 -0
- package/skill/examples/series/components/OutcomeNote.tsx +28 -0
- package/skill/examples/series/components/PlayAction.tsx +29 -0
- package/skill/examples/series/components/RestoreAction.tsx +33 -0
- package/skill/examples/series/components/Root.tsx +75 -0
- package/skill/examples/series/components/SaveTitle.tsx +34 -0
- package/skill/examples/series/components/Shell.tsx +75 -0
- package/skill/examples/series/components/TitleCard.tsx +62 -0
- package/skill/examples/series/components/UnlockAction.tsx +10 -0
- package/skill/examples/series/preview/phone-home.jpg +0 -0
- package/skill/examples/series/preview/tv-detail.jpg +0 -0
- package/skill/examples/series/preview/tv-home.jpg +0 -0
- package/skill/examples/series/screens/portrait/Account.tsx +125 -0
- package/skill/examples/series/screens/portrait/Browse.tsx +61 -0
- package/skill/examples/series/screens/portrait/Detail.tsx +231 -0
- package/skill/examples/series/screens/portrait/Home.tsx +109 -0
- package/skill/examples/series/screens/portrait/MyList.tsx +44 -0
- package/skill/examples/series/screens/portrait/Plans.tsx +131 -0
- package/skill/examples/series/screens/portrait/Player.tsx +138 -0
- package/skill/examples/series/screens/portrait/Profiles.tsx +103 -0
- package/skill/examples/series/screens/portrait/Search.tsx +50 -0
- package/skill/examples/series/screens/portrait/SignIn.tsx +94 -0
- package/skill/examples/series/screens/portrait/SignUp.tsx +100 -0
- package/skill/examples/series/store.tsx +192 -0
- package/skill/examples/series/theme.ts +32 -0
- package/skill/guides/final-pricing-capabilities.md +13 -0
- package/skill/reference/api.md +842 -0
- package/skill/reference/components.md +1782 -0
- package/skill/reference/packages.md +24 -0
- package/skill/scripts/assemble-checkout.mjs +93 -0
- package/skill/scripts/local-save.mjs +513 -0
- package/skill/scripts/materialize.mjs +319 -0
- package/skill/scripts/workspace-state.mjs +183 -0
- package/types/adelin-access.d.ts +70 -0
- package/types/adelin-analytics.d.ts +5 -0
- package/types/adelin-assets.d.ts +26 -0
- package/types/adelin-auth.d.ts +37 -0
- package/types/adelin-content.d.ts +112 -0
- package/types/adelin-device.d.ts +195 -0
- package/types/adelin-downloads.d.ts +47 -0
- package/types/adelin-env.d.ts +8 -0
- package/types/adelin-globals.d.ts +19 -0
- package/types/adelin-i18n.d.ts +31 -0
- package/types/adelin-native-stack.d.ts +178 -0
- package/types/adelin-navigation.d.ts +264 -0
- package/types/adelin-profiles.d.ts +51 -0
- package/types/adelin-react.d.ts +49 -0
- package/types/adelin-reanimated.d.ts +376 -0
- package/types/adelin-storage.d.ts +9 -0
- package/types/adelin-store.d.ts +74 -0
- package/types/adelin-ui.d.ts +1518 -0
- package/types/adelin-utils.d.ts +7 -0
- package/types/adelin-worklets.d.ts +15 -0
- package/workspace-tsconfig.json +53 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useEffect, useState } from '@adelin/react';
|
|
2
|
+
import { useNavigation } from '@adelin/navigation';
|
|
3
|
+
import { useAuth } from '@adelin/auth';
|
|
4
|
+
import { useTranslation } from '@adelin/i18n';
|
|
5
|
+
import { useDispatch, useSelector } from '@adelin/store';
|
|
6
|
+
import { FocusGroup, Image, KeyboardAvoidingView, SafeAreaView, ScrollView, StyleSheet, Text, View, theme, useWindowDimensions, Screen } from '@adelin/ui';
|
|
7
|
+
import { Platform } from '@adelin/device';
|
|
8
|
+
import { login } from '../../store';
|
|
9
|
+
import Action from '../../components/Action';
|
|
10
|
+
import Field from '../../components/Field';
|
|
11
|
+
import Feedback from '../../components/Feedback';
|
|
12
|
+
import logo from '../../assets/logo.png';
|
|
13
|
+
|
|
14
|
+
export default function SignIn() {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const auth = useAuth();
|
|
17
|
+
const navigation = useNavigation();
|
|
18
|
+
const dispatch = useDispatch();
|
|
19
|
+
const pending = useSelector(state => state.account.pending);
|
|
20
|
+
const registrationCompleted = useSelector(state => state.account.registrationCompleted);
|
|
21
|
+
const [email, setEmail] = useState('');
|
|
22
|
+
const [password, setPassword] = useState('');
|
|
23
|
+
const [message, setMessage] = useState('');
|
|
24
|
+
const { width, height } = useWindowDimensions();
|
|
25
|
+
const wide = width >= 840 && height >= 480;
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (auth.status === 'signed-in' && !auth.signInRequired) navigation.replace('Account');
|
|
29
|
+
}, [auth.status, auth.signInRequired]);
|
|
30
|
+
|
|
31
|
+
const submit = () => {
|
|
32
|
+
setMessage('');
|
|
33
|
+
dispatch(login({ email: email.trim(), password })).unwrap()
|
|
34
|
+
.then(() => { setPassword(''); })
|
|
35
|
+
.catch(error => { setPassword(''); setMessage(error.message); });
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Screen>
|
|
40
|
+
<View style={styles.page}>
|
|
41
|
+
<KeyboardAvoidingView behavior="padding" style={styles.body}>
|
|
42
|
+
<ScrollView style={styles.body} contentContainerStyle={styles.scrollContent} keyboardShouldPersistTaps="handled" showsVerticalScrollIndicator={false}>
|
|
43
|
+
<SafeAreaView edges={['top', 'left', 'right', 'bottom']}>
|
|
44
|
+
{auth.status === 'loading' ? <Feedback title={t('common.loading')} message={t('common.checkingSignIn')} loading /> : (
|
|
45
|
+
<View style={[styles.band, wide && styles.bandWide]}>
|
|
46
|
+
<View style={[styles.layout, wide && styles.layoutWide]}>
|
|
47
|
+
<View style={[styles.brand, wide && styles.brandWide]}><Image source={logo} accessibilityLabel={t('common.brand')} resizeMode="contain" style={styles.logo} /><Text style={styles.tagline}>{t('common.tagline')}</Text></View>
|
|
48
|
+
<View style={styles.form}>
|
|
49
|
+
<Text style={styles.title}>{t('common.signIn')}</Text>
|
|
50
|
+
<Text style={styles.description}>{t('signIn.description')}</Text>
|
|
51
|
+
{registrationCompleted && <Text style={styles.notice} accessibilityRole="alert">{t('signIn.verifyNotice')}</Text>}
|
|
52
|
+
<FocusGroup direction="vertical" remember autoFocus>
|
|
53
|
+
<View>
|
|
54
|
+
<Field label={t('common.email')} value={email} onChangeText={setEmail} email disabled={pending} />
|
|
55
|
+
<Field label={t('common.password')} value={password} onChangeText={setPassword} secret disabled={pending} />
|
|
56
|
+
{message.length > 0 && <Text style={styles.error} accessibilityRole="alert">{message}</Text>}
|
|
57
|
+
<Action block={!wide} label={pending ? t('signIn.signingIn') : t('common.signIn')} primary disabled={pending} onPress={submit} />
|
|
58
|
+
<Text style={styles.newViewer}>{t('signIn.newHere')}</Text>
|
|
59
|
+
<FocusGroup direction="horizontal" remember>
|
|
60
|
+
<View style={[styles.footer, !wide && styles.stack]}>
|
|
61
|
+
<View style={[styles.footerAction, !wide && styles.stackAction]}><Action block={!wide} label={t('common.createAccount')} disabled={pending} onPress={() => { setPassword(''); navigation.navigate('SignUp'); }} /></View>
|
|
62
|
+
{!auth.signInRequired && <View style={[styles.footerAction, !wide && styles.stackAction]}><Action block={!wide} label={t('common.continueBrowsing')} disabled={pending} onPress={() => { setPassword(''); navigation.replace('Account'); }} /></View>}
|
|
63
|
+
</View>
|
|
64
|
+
</FocusGroup>
|
|
65
|
+
</View>
|
|
66
|
+
</FocusGroup>
|
|
67
|
+
</View>
|
|
68
|
+
</View>
|
|
69
|
+
</View>
|
|
70
|
+
)}
|
|
71
|
+
</SafeAreaView>
|
|
72
|
+
</ScrollView>
|
|
73
|
+
</KeyboardAvoidingView>
|
|
74
|
+
</View>
|
|
75
|
+
</Screen>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
page: { flex: 1, backgroundColor: theme.colors.background },
|
|
81
|
+
body: { flex: 1 },
|
|
82
|
+
scrollContent: { flexGrow: 1, justifyContent: 'center', paddingVertical: Platform.select({ tv: theme.spacing.xl, default: theme.spacing.md }) },
|
|
83
|
+
band: { backgroundColor: theme.colors.surface, borderTopWidth: 1, borderBottomWidth: 1, borderColor: theme.colors.border, paddingVertical: Platform.select({ tv: 28, default: theme.spacing.xl }), paddingHorizontal: Platform.select({ tv: theme.spacing.xl, default: theme.spacing.md }) },
|
|
84
|
+
bandWide: { paddingVertical: Platform.select({ tv: 36, default: 64 }) },
|
|
85
|
+
layout: { width: '100%', maxWidth: Platform.select({ tv: 720, default: 880 }), alignSelf: 'center' },
|
|
86
|
+
layoutWide: { flexDirection: 'row', alignItems: 'center' },
|
|
87
|
+
brand: { marginBottom: theme.spacing.xl },
|
|
88
|
+
brandWide: { flex: 1, marginBottom: 0, marginRight: theme.spacing.xl },
|
|
89
|
+
logo: { width: 210, height: 32 },
|
|
90
|
+
tagline: { color: theme.colors.textSecondary, fontSize: Platform.select({ tv: 11, default: 15 }), lineHeight: Platform.select({ tv: 16, default: 22 }), marginTop: theme.spacing.sm },
|
|
91
|
+
form: { width: '100%', maxWidth: Platform.select({ tv: 340, default: 480 }) },
|
|
92
|
+
title: { color: theme.colors.text, fontSize: Platform.select({ tv: 24, default: 30 }), lineHeight: Platform.select({ tv: 29, default: 36 }), fontWeight: '800', letterSpacing: -0.8 },
|
|
93
|
+
description: { color: theme.colors.textSecondary, fontSize: Platform.select({ tv: 10, default: 15 }), lineHeight: Platform.select({ tv: 15, default: 22 }), marginTop: theme.spacing.xs, marginBottom: Platform.select({ tv: 16, default: theme.spacing.lg }) },
|
|
94
|
+
notice: { color: theme.colors.success, fontSize: Platform.select({ tv: 11, default: 14 }), lineHeight: Platform.select({ tv: 17, default: 21 }), marginBottom: theme.spacing.md },
|
|
95
|
+
error: { color: theme.colors.error, fontSize: Platform.select({ tv: 11, default: 14 }), lineHeight: Platform.select({ tv: 17, default: 21 }), marginBottom: theme.spacing.md },
|
|
96
|
+
newViewer: { color: theme.colors.textSecondary, fontSize: Platform.select({ tv: 11, default: 14 }), lineHeight: 20, marginTop: theme.spacing.lg, marginBottom: theme.spacing.sm },
|
|
97
|
+
footer: { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center' },
|
|
98
|
+
stack: { flexDirection: 'column', flexWrap: 'nowrap', alignItems: 'stretch', alignSelf: 'stretch', width: '100%' },
|
|
99
|
+
stackAction: { marginRight: 0 },
|
|
100
|
+
footerAction: { marginRight: theme.spacing.sm, marginBottom: theme.spacing.sm },
|
|
101
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useEffect, useState } from '@adelin/react';
|
|
2
|
+
import { useNavigation } from '@adelin/navigation';
|
|
3
|
+
import { useAuth } from '@adelin/auth';
|
|
4
|
+
import { useTranslation } from '@adelin/i18n';
|
|
5
|
+
import { useDispatch, useSelector } from '@adelin/store';
|
|
6
|
+
import { FocusGroup, Image, KeyboardAvoidingView, SafeAreaView, ScrollView, StyleSheet, Text, View, theme, useWindowDimensions, Screen } from '@adelin/ui';
|
|
7
|
+
import { Platform } from '@adelin/device';
|
|
8
|
+
import { register } from '../../store';
|
|
9
|
+
import Action from '../../components/Action';
|
|
10
|
+
import Field from '../../components/Field';
|
|
11
|
+
import Feedback from '../../components/Feedback';
|
|
12
|
+
import logo from '../../assets/logo.png';
|
|
13
|
+
|
|
14
|
+
export default function SignUp() {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const auth = useAuth();
|
|
17
|
+
const navigation = useNavigation();
|
|
18
|
+
const dispatch = useDispatch();
|
|
19
|
+
const pending = useSelector(state => state.account.pending);
|
|
20
|
+
const [email, setEmail] = useState('');
|
|
21
|
+
const [password, setPassword] = useState('');
|
|
22
|
+
const [confirm, setConfirm] = useState('');
|
|
23
|
+
const [message, setMessage] = useState('');
|
|
24
|
+
const { width, height } = useWindowDimensions();
|
|
25
|
+
const wide = width >= 840 && height >= 480;
|
|
26
|
+
const [registered, setRegistered] = useState(false);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (auth.status === 'signed-in' && !auth.signInRequired) navigation.replace('Account');
|
|
30
|
+
}, [auth.status, auth.signInRequired]);
|
|
31
|
+
|
|
32
|
+
const submit = () => {
|
|
33
|
+
setMessage('');
|
|
34
|
+
dispatch(register({ email: email.trim(), password, confirmPassword: confirm })).unwrap()
|
|
35
|
+
.then(() => { setPassword(''); setConfirm(''); setRegistered(true); })
|
|
36
|
+
.catch(error => { setPassword(''); setConfirm(''); setMessage(error.message); });
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Screen>
|
|
41
|
+
<View style={styles.page}>
|
|
42
|
+
<KeyboardAvoidingView behavior="padding" style={styles.body}>
|
|
43
|
+
<ScrollView style={styles.body} contentContainerStyle={styles.scrollContent} keyboardShouldPersistTaps="handled" showsVerticalScrollIndicator={false}>
|
|
44
|
+
<SafeAreaView edges={['top', 'left', 'right', 'bottom']}>
|
|
45
|
+
{auth.status === 'loading' ? <Feedback title={t('common.loading')} message={t('common.checkingSignIn')} loading /> : (
|
|
46
|
+
<View style={[styles.band, wide && styles.bandWide]}>
|
|
47
|
+
<View style={[styles.layout, wide && styles.layoutWide]}>
|
|
48
|
+
<View style={[styles.brand, wide && styles.brandWide]}><Image source={logo} accessibilityLabel={t('common.brand')} resizeMode="contain" style={styles.logo} /><Text style={styles.tagline}>{t('common.tagline')}</Text></View>
|
|
49
|
+
<View style={styles.form}>
|
|
50
|
+
<Text style={styles.title}>{t('signUp.title')}</Text>
|
|
51
|
+
<Text style={styles.description}>{t('signUp.description')}</Text>
|
|
52
|
+
{registered ? (
|
|
53
|
+
<FocusGroup direction="vertical" autoFocus>
|
|
54
|
+
<View><Text style={styles.notice} accessibilityRole="alert">{t('signUp.registered')}</Text><Action block={!wide} label={t('signUp.returnToSignIn')} primary preferred onPress={() => navigation.replace('SignIn')} /></View>
|
|
55
|
+
</FocusGroup>
|
|
56
|
+
) : (
|
|
57
|
+
<FocusGroup direction="vertical" remember autoFocus>
|
|
58
|
+
<View>
|
|
59
|
+
<Field label={t('common.email')} value={email} onChangeText={setEmail} email disabled={pending} />
|
|
60
|
+
<Field label={t('common.password')} value={password} onChangeText={setPassword} secret disabled={pending} />
|
|
61
|
+
<Field label={t('signUp.confirmPassword')} value={confirm} onChangeText={setConfirm} secret disabled={pending} />
|
|
62
|
+
{message.length > 0 && <Text style={styles.error} accessibilityRole="alert">{message}</Text>}
|
|
63
|
+
<Action block={!wide} label={pending ? t('signUp.creating') : t('signUp.create')} primary disabled={pending} onPress={submit} />
|
|
64
|
+
<FocusGroup direction="horizontal" remember>
|
|
65
|
+
<View style={[styles.footer, !wide && styles.stack]}>
|
|
66
|
+
<View style={[styles.footerAction, !wide && styles.stackAction]}><Action block={!wide} label={t('signUp.signInInstead')} disabled={pending} onPress={() => { setPassword(''); setConfirm(''); navigation.navigate('SignIn'); }} /></View>
|
|
67
|
+
{!auth.signInRequired && <View style={[styles.footerAction, !wide && styles.stackAction]}><Action block={!wide} label={t('common.continueBrowsing')} disabled={pending} onPress={() => { setPassword(''); setConfirm(''); navigation.replace('Account'); }} /></View>}
|
|
68
|
+
</View>
|
|
69
|
+
</FocusGroup>
|
|
70
|
+
</View>
|
|
71
|
+
</FocusGroup>
|
|
72
|
+
)}
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
</View>
|
|
76
|
+
)}
|
|
77
|
+
</SafeAreaView>
|
|
78
|
+
</ScrollView>
|
|
79
|
+
</KeyboardAvoidingView>
|
|
80
|
+
</View>
|
|
81
|
+
</Screen>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
page: { flex: 1, backgroundColor: theme.colors.background },
|
|
87
|
+
body: { flex: 1 },
|
|
88
|
+
scrollContent: { flexGrow: 1, justifyContent: 'center', paddingVertical: Platform.select({ tv: theme.spacing.xl, default: theme.spacing.md }) },
|
|
89
|
+
band: { backgroundColor: theme.colors.surface, borderTopWidth: 1, borderBottomWidth: 1, borderColor: theme.colors.border, paddingVertical: Platform.select({ tv: 28, default: theme.spacing.xl }), paddingHorizontal: Platform.select({ tv: theme.spacing.xl, default: theme.spacing.md }) },
|
|
90
|
+
bandWide: { paddingVertical: Platform.select({ tv: 36, default: 64 }) },
|
|
91
|
+
layout: { width: '100%', maxWidth: Platform.select({ tv: 720, default: 880 }), alignSelf: 'center' },
|
|
92
|
+
layoutWide: { flexDirection: 'row', alignItems: 'center' },
|
|
93
|
+
brand: { marginBottom: theme.spacing.xl },
|
|
94
|
+
brandWide: { flex: 1, marginBottom: 0, marginRight: theme.spacing.xl },
|
|
95
|
+
logo: { width: 210, height: 32 },
|
|
96
|
+
tagline: { color: theme.colors.textSecondary, fontSize: Platform.select({ tv: 11, default: 15 }), lineHeight: Platform.select({ tv: 16, default: 22 }), marginTop: theme.spacing.sm },
|
|
97
|
+
form: { width: '100%', maxWidth: Platform.select({ tv: 340, default: 480 }) },
|
|
98
|
+
title: { color: theme.colors.text, fontSize: Platform.select({ tv: 24, default: 30 }), lineHeight: Platform.select({ tv: 29, default: 36 }), fontWeight: '800', letterSpacing: -0.8 },
|
|
99
|
+
description: { color: theme.colors.textSecondary, fontSize: Platform.select({ tv: 10, default: 15 }), lineHeight: Platform.select({ tv: 15, default: 22 }), marginTop: theme.spacing.xs, marginBottom: Platform.select({ tv: 16, default: theme.spacing.lg }) },
|
|
100
|
+
notice: { color: theme.colors.success, fontSize: Platform.select({ tv: 11, default: 14 }), lineHeight: Platform.select({ tv: 17, default: 21 }), marginBottom: theme.spacing.md },
|
|
101
|
+
error: { color: theme.colors.error, fontSize: Platform.select({ tv: 11, default: 14 }), lineHeight: Platform.select({ tv: 17, default: 21 }), marginBottom: theme.spacing.md },
|
|
102
|
+
footer: { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', marginTop: theme.spacing.md },
|
|
103
|
+
stack: { flexDirection: 'column', flexWrap: 'nowrap', alignItems: 'stretch', alignSelf: 'stretch', width: '100%' },
|
|
104
|
+
stackAction: { marginRight: 0 },
|
|
105
|
+
footerAction: { marginRight: theme.spacing.sm, marginBottom: theme.spacing.sm },
|
|
106
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { createAsyncThunk, createSlice, type PayloadAction } from '@adelin/store';
|
|
2
|
+
import { content, type ContentCollection, type ContentItem } from '@adelin/content';
|
|
3
|
+
import { signIn, signUp, signOut } from '@adelin/auth';
|
|
4
|
+
import { profiles, progress, type Profile, type Progress } from '@adelin/profiles';
|
|
5
|
+
|
|
6
|
+
export const loadLibrary = createAsyncThunk('library/loadLibrary', async () => {
|
|
7
|
+
const entries = await content.list();
|
|
8
|
+
const collections = await content.collections();
|
|
9
|
+
return { entries, collections };
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const login = createAsyncThunk('account/login', async (input: { email: string; password: string }) => signIn(input));
|
|
13
|
+
export const register = createAsyncThunk('account/register', async (input: { email: string; password: string; confirmPassword?: string }) => signUp(input));
|
|
14
|
+
export const logout = createAsyncThunk('account/logout', async () => signOut());
|
|
15
|
+
|
|
16
|
+
export const loadProfiles = createAsyncThunk('profiles/loadProfiles', async () => {
|
|
17
|
+
const list = await profiles.list();
|
|
18
|
+
const active = await profiles.active();
|
|
19
|
+
return { list, active: active ?? '' };
|
|
20
|
+
});
|
|
21
|
+
export const chooseProfile = createAsyncThunk('profiles/chooseProfile', async (id: string) => {
|
|
22
|
+
await profiles.select(id);
|
|
23
|
+
return id;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const loadWatching = createAsyncThunk('watching/loadWatching', async (profileId: string) => {
|
|
27
|
+
const rows = await progress.list(profileId);
|
|
28
|
+
return { profileId: profileId, rows: rows };
|
|
29
|
+
});
|
|
30
|
+
export const removeWatching = createAsyncThunk('watching/removeWatching', async (input: { profileId: string; entryId: string }) => {
|
|
31
|
+
await progress.clear(input.profileId, input.entryId);
|
|
32
|
+
return input.entryId;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const loadWatched = createAsyncThunk('watching/loadWatched', async (input: { profileId: string; entryId: string }) => {
|
|
36
|
+
const ids = await progress.watched(input.profileId, input.entryId);
|
|
37
|
+
return { profileId: input.profileId, ids: ids };
|
|
38
|
+
});
|
|
39
|
+
export const toggleWatched = createAsyncThunk('watching/toggleWatched', async (input: { profileId: string; entryId: string; watched: boolean }) => {
|
|
40
|
+
if (input.watched) {
|
|
41
|
+
await progress.markUnwatched(input.profileId, input.entryId);
|
|
42
|
+
} else {
|
|
43
|
+
await progress.markWatched(input.profileId, input.entryId);
|
|
44
|
+
}
|
|
45
|
+
return { entryId: input.entryId, watched: !input.watched };
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const watching = createSlice({
|
|
49
|
+
name: 'watching',
|
|
50
|
+
initialState: { profileId: '', rows: [] as Progress[], watchedIds: [] as string[] },
|
|
51
|
+
reducers: {
|
|
52
|
+
resetWatching(state, action: PayloadAction<string>) { state.profileId = action.payload; state.rows = []; state.watchedIds = []; },
|
|
53
|
+
},
|
|
54
|
+
extraReducers: builder => {
|
|
55
|
+
builder.addCase(loadWatching.fulfilled, (state, action) => { if (state.profileId === action.payload.profileId) state.rows = action.payload.rows; });
|
|
56
|
+
builder.addCase(loadWatched.fulfilled, (state, action) => { if (state.profileId === action.payload.profileId) state.watchedIds = action.payload.ids; });
|
|
57
|
+
builder.addCase(toggleWatched.fulfilled, (state, action) => {
|
|
58
|
+
const others = state.watchedIds.filter(id => id !== action.payload.entryId);
|
|
59
|
+
state.watchedIds = action.payload.watched ? [action.payload.entryId, ...others] : others;
|
|
60
|
+
});
|
|
61
|
+
builder.addCase(removeWatching.fulfilled, (state, action) => { state.rows = state.rows.filter(row => row.entryId !== action.payload); });
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const profileState = createSlice({
|
|
66
|
+
name: 'profiles',
|
|
67
|
+
initialState: { list: [] as Profile[], activeId: '', status: 'idle' },
|
|
68
|
+
reducers: {
|
|
69
|
+
clearProfiles(state) { state.list = []; state.activeId = ''; state.status = 'idle'; },
|
|
70
|
+
},
|
|
71
|
+
extraReducers: builder => {
|
|
72
|
+
builder.addCase(loadProfiles.pending, state => { state.status = 'loading'; });
|
|
73
|
+
builder.addCase(loadProfiles.fulfilled, (state, action) => {
|
|
74
|
+
state.list = action.payload.list;
|
|
75
|
+
state.activeId = action.payload.active !== '' ? action.payload.active : action.payload.list.find(profile => profile.isDefault)?.id ?? '';
|
|
76
|
+
state.status = 'ready';
|
|
77
|
+
});
|
|
78
|
+
builder.addCase(loadProfiles.rejected, state => { state.status = 'failed'; });
|
|
79
|
+
builder.addCase(chooseProfile.fulfilled, (state, action) => { state.activeId = action.payload; });
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const account = createSlice({
|
|
84
|
+
name: 'account',
|
|
85
|
+
initialState: { pending: false, registrationCompleted: false },
|
|
86
|
+
reducers: {},
|
|
87
|
+
extraReducers: builder => {
|
|
88
|
+
builder.addCase(login.pending, state => { state.pending = true; state.registrationCompleted = false; });
|
|
89
|
+
builder.addCase(login.fulfilled, state => { state.pending = false; });
|
|
90
|
+
builder.addCase(login.rejected, state => { state.pending = false; });
|
|
91
|
+
builder.addCase(register.pending, state => { state.pending = true; state.registrationCompleted = false; });
|
|
92
|
+
builder.addCase(register.fulfilled, state => { state.pending = false; state.registrationCompleted = true; });
|
|
93
|
+
builder.addCase(register.rejected, state => { state.pending = false; });
|
|
94
|
+
builder.addCase(logout.pending, state => { state.pending = true; });
|
|
95
|
+
builder.addCase(logout.fulfilled, state => { state.pending = false; state.registrationCompleted = false; });
|
|
96
|
+
builder.addCase(logout.rejected, state => { state.pending = false; });
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const library = createSlice({
|
|
101
|
+
name: 'library',
|
|
102
|
+
initialState: { entries: [] as ContentItem[], collections: [] as ContentCollection[], status: 'idle' },
|
|
103
|
+
reducers: {},
|
|
104
|
+
extraReducers: builder => {
|
|
105
|
+
builder.addCase(loadLibrary.pending, state => { state.status = 'loading'; });
|
|
106
|
+
builder.addCase(loadLibrary.fulfilled, (state, action) => {
|
|
107
|
+
state.entries = action.payload.entries;
|
|
108
|
+
state.collections = action.payload.collections;
|
|
109
|
+
state.status = 'ready';
|
|
110
|
+
});
|
|
111
|
+
builder.addCase(loadLibrary.rejected, state => { state.status = 'failed'; });
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export const billboard = createSlice({
|
|
116
|
+
name: 'billboard',
|
|
117
|
+
initialState: { focusedId: '', featuredId: '', previousId: '', changes: 0 },
|
|
118
|
+
reducers: {
|
|
119
|
+
feature(state, action: PayloadAction<string>) { state.focusedId = action.payload; },
|
|
120
|
+
settle(state, action: PayloadAction<string>) {
|
|
121
|
+
if (action.payload !== state.featuredId) {
|
|
122
|
+
state.previousId = state.featuredId;
|
|
123
|
+
state.featuredId = action.payload;
|
|
124
|
+
state.changes = state.changes + 1;
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export const { feature, settle } = billboard.actions;
|
|
131
|
+
export const { clearProfiles } = profileState.actions;
|
|
132
|
+
export const { resetWatching } = watching.actions;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createTheme } from '@adelin/ui';
|
|
2
|
+
|
|
3
|
+
export default createTheme({
|
|
4
|
+
colors: {
|
|
5
|
+
background: '#07080A',
|
|
6
|
+
surface: '#121417',
|
|
7
|
+
surfaceLight: '#1E2126',
|
|
8
|
+
primary: '#F3EFE7',
|
|
9
|
+
primaryLight: '#2B2E33',
|
|
10
|
+
accent: '#A8C3D2',
|
|
11
|
+
text: '#F3EFE7',
|
|
12
|
+
textSecondary: '#B5B3AD',
|
|
13
|
+
textMuted: '#7C7E80',
|
|
14
|
+
border: '#2A2D32',
|
|
15
|
+
error: '#E0806F',
|
|
16
|
+
success: '#8EC4A4',
|
|
17
|
+
},
|
|
18
|
+
spacing: { xs: 4, sm: 8, md: 16, lg: 24, xl: 48 },
|
|
19
|
+
gradients: {
|
|
20
|
+
heroSolid: '#07080A',
|
|
21
|
+
heroDeep: 'rgba(7,8,10,0.94)',
|
|
22
|
+
heroMiddle: 'rgba(7,8,10,0.62)',
|
|
23
|
+
heroClear: 'rgba(7,8,10,0)',
|
|
24
|
+
barShade: 'rgba(7,8,10,0.72)',
|
|
25
|
+
cardShade: 'rgba(7,8,10,0.88)',
|
|
26
|
+
tag: 'rgba(7,8,10,0.74)',
|
|
27
|
+
ghost: 'rgba(243,239,231,0.14)',
|
|
28
|
+
ghostStrong: 'rgba(243,239,231,0.32)',
|
|
29
|
+
playerChrome: 'rgba(7,8,10,0.9)',
|
|
30
|
+
scrim: 'rgba(7,8,10,0.84)',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Atlas — documentary film journal
|
|
2
|
+
|
|
3
|
+
**Use case:** Documentary films or other subject-led collections where the logline matters as much
|
|
4
|
+
as the still. [Home on TV](preview/tv-home.jpg), [Detail on TV](preview/tv-detail.jpg) and
|
|
5
|
+
[Home on phone](preview/phone-home.jpg) show the intended density and crop.
|
|
6
|
+
|
|
7
|
+
There is no sidebar. A masthead with a heavy wordmark, tracked small-caps destinations and an ink
|
|
8
|
+
rule frames every screen; phone keeps the wordmark and adds a bottom tab bar. Home opens with a
|
|
9
|
+
cover story: kicker, headline and standfirst on the left, the still bleeding off the right edge,
|
|
10
|
+
and one action that opens the film. Each collection follows as a section front: its name and
|
|
11
|
+
editorial note in a left column, its story cards to the right.
|
|
12
|
+
|
|
13
|
+
Study `components/StoryCard.tsx` first. A story card is a portrait still, a headline and the
|
|
14
|
+
description's first sentence; focus lifts it onto white paper with an ink edge without changing
|
|
15
|
+
its size. `components/LibraryRail.tsx` builds the section front, `screens/portrait/Home.tsx`
|
|
16
|
+
derives sections from leaf collections with at least three films, and `components/StoryMeta.tsx`
|
|
17
|
+
shows only real runtime and picture quality. `screens/portrait/Detail.tsx` is an article: still,
|
|
18
|
+
headline, standfirst, Play, the rest of the description as body copy, then more from the film's
|
|
19
|
+
collection. `components/Action.tsx` and the masthead links invert to ink when focused.
|
|
20
|
+
|
|
21
|
+
Watch progress belongs to the viewer's default profile; there is no picker, and a viewer without
|
|
22
|
+
a profile gets one named "Reader". The cover story leads with "Watch the film" beside "About the film"; once
|
|
23
|
+
the film's saved place arrives the same button reads "Resume · 20 min left", so focus stays on it. "Where you left off" follows the cover as one more section front, hidden when empty:
|
|
24
|
+
its cards trade the standfirst for a thin vermilion rule and the minutes left in small capitals,
|
|
25
|
+
and open the player. The article's Play reads "Resume · N min left" in the same way, and a quiet
|
|
26
|
+
"Mark as seen" / "Seen" outline action sits beside it for films only. A seen film's card carries a small "SEEN" tab of paper and ink in the still's
|
|
27
|
+
corner, never vermilion; each screen asks which of its films are seen in one request.
|
|
28
|
+
|
|
29
|
+
The palette is warm paper and ink with one vermilion for kickers, the selected marker and the
|
|
30
|
+
primary action; photography supplies the rest. Type uses one font stack, so headlines carry the
|
|
31
|
+
voice through weight 900 and tight tracking against light standfirsts. The design depends on
|
|
32
|
+
usable poster art and a first sentence that describes the subject. Without posters, the card falls
|
|
33
|
+
back to the backdrop; without descriptions, write a stronger section note rather than invented copy.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineApp } from '@adelin/navigation';
|
|
2
|
+
import Root from './components/Root';
|
|
3
|
+
|
|
4
|
+
export default defineApp({
|
|
5
|
+
name: 'Atlas',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
root: Root,
|
|
8
|
+
statusBar: { style: 'dark' },
|
|
9
|
+
designIntent: {
|
|
10
|
+
audience: 'Viewers who choose documentaries by subject and want a reason to open each film.',
|
|
11
|
+
thesis: 'A film journal: every film arrives with a headline and a one-line standfirst, so the subject leads and the still supports it.',
|
|
12
|
+
palette: 'Warm paper and ink, with one vermilion for kickers and the primary action. Photography supplies the rest of the colour.',
|
|
13
|
+
typography: 'Heavy, tightly tracked headlines against light standfirsts and small tracked capitals for kickers and navigation.',
|
|
14
|
+
composition: 'A masthead with a hairline rule, a cover story with text left and the still bleeding off the right edge, then sections of story cards. Phone stacks still, headline and sections under a slim masthead.',
|
|
15
|
+
motif: 'Story cards: a portrait still with headline and standfirst that lifts onto white paper with an ink edge when focused; focused controls invert to ink.',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useState } from '@adelin/react';
|
|
2
|
+
import { Icon, Pressable, StyleSheet, Text, theme, useWindowDimensions } from '@adelin/ui';
|
|
3
|
+
import { Platform } from '@adelin/device';
|
|
4
|
+
|
|
5
|
+
export default function Action({ label, onPress, primary = false, disabled = false, preferred = false, focusKey, icon }: {
|
|
6
|
+
label: string;
|
|
7
|
+
onPress: () => void;
|
|
8
|
+
primary?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
preferred?: boolean;
|
|
11
|
+
focusKey?: string;
|
|
12
|
+
icon?: string;
|
|
13
|
+
}) {
|
|
14
|
+
const [focused, setFocused] = useState(false);
|
|
15
|
+
const { width, height } = useWindowDimensions();
|
|
16
|
+
const tone = focused ? theme.colors.surface : primary ? theme.colors.surface : theme.colors.text;
|
|
17
|
+
return (
|
|
18
|
+
<Pressable
|
|
19
|
+
onPress={onPress}
|
|
20
|
+
onFocus={() => setFocused(true)}
|
|
21
|
+
onBlur={() => setFocused(false)}
|
|
22
|
+
disabled={disabled}
|
|
23
|
+
hasTVPreferredFocus={preferred}
|
|
24
|
+
focusKey={focusKey}
|
|
25
|
+
style={[styles.button, primary === true && styles.primary, focused && styles.focused, disabled === true && styles.disabled]}
|
|
26
|
+
accessibilityRole="button"
|
|
27
|
+
accessibilityLabel={label}
|
|
28
|
+
accessibilityState={{ disabled }}
|
|
29
|
+
>
|
|
30
|
+
{!!icon && <Icon icon={icon} size={width >= 840 && height >= 480 ? 11 : 16} color={tone} />}
|
|
31
|
+
<Text style={[styles.label, !!icon && styles.labelWithIcon, { color: tone }]}>{label}</Text>
|
|
32
|
+
</Pressable>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
button: { minHeight: Platform.select({ tv: 30, default: 46 }), flexDirection: 'row', justifyContent: 'center', alignItems: 'center', alignSelf: 'flex-start', paddingHorizontal: Platform.select({ tv: 14, default: 18 }), borderWidth: Platform.select({ tv: 1, default: 1.5 }), borderColor: theme.colors.text, backgroundColor: 'transparent' },
|
|
38
|
+
primary: { backgroundColor: theme.colors.primary, borderColor: theme.colors.primary },
|
|
39
|
+
focused: { backgroundColor: theme.colors.text, borderColor: theme.colors.text },
|
|
40
|
+
disabled: { opacity: 0.45 },
|
|
41
|
+
label: { fontSize: Platform.select({ tv: 9, default: 15 }), lineHeight: Platform.select({ tv: 13, default: 20 }), fontWeight: '700', letterSpacing: Platform.select({ tv: 0.6, default: 0.2 }) },
|
|
42
|
+
labelWithIcon: { marginLeft: Platform.select({ tv: 6, default: 8 }) },
|
|
43
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FlashList, FocusGroup, StyleSheet, View, theme, useSafeAreaInsets, useWindowDimensions } from '@adelin/ui';
|
|
2
|
+
import { useEffect } from '@adelin/react';
|
|
3
|
+
import { useDispatch, useSelector } from '@adelin/store';
|
|
4
|
+
import { loadSeen } from '../store';
|
|
5
|
+
import StoryCard from './StoryCard';
|
|
6
|
+
import Feedback from './Feedback';
|
|
7
|
+
|
|
8
|
+
export default function CatalogGrid({ entries, emptyTitle, emptyMessage }: {
|
|
9
|
+
entries: { id: string; title: string; description?: string; artwork: { backdrop?: string; poster?: string } }[];
|
|
10
|
+
emptyTitle: string;
|
|
11
|
+
emptyMessage: string;
|
|
12
|
+
}) {
|
|
13
|
+
const dispatch = useDispatch();
|
|
14
|
+
const profileId = useSelector(state => state.profile.id);
|
|
15
|
+
const shownKey = entries.map(entry => entry.id).join(',');
|
|
16
|
+
useEffect(() => { if (profileId.length > 0 && entries.length > 0) dispatch(loadSeen({ profileId: profileId, entryIds: entries.map(entry => entry.id) })); }, [profileId, shownKey]);
|
|
17
|
+
const { width, height } = useWindowDimensions();
|
|
18
|
+
const insets = useSafeAreaInsets();
|
|
19
|
+
const expanded = width >= 840 && height >= 480;
|
|
20
|
+
const columns = expanded ? 7 : width >= 600 ? 4 : 2;
|
|
21
|
+
const available = width - insets.left - insets.right - (expanded ? 38 : 36);
|
|
22
|
+
const cardWidth = Math.floor((available - 6 * (columns - 1)) / columns);
|
|
23
|
+
const rows = entries.filter((item, index) => index % columns === 0).map((item, index) => ({ id: item.id, entries: entries.slice(index * columns, index * columns + columns) }));
|
|
24
|
+
return (
|
|
25
|
+
<FocusGroup direction="vertical" remember>
|
|
26
|
+
<View style={styles.grid}>
|
|
27
|
+
<FlashList data={rows} keyExtractor={item => item.id} style={styles.grid} contentContainerStyle={styles.content} showsVerticalScrollIndicator={false}
|
|
28
|
+
ListEmptyComponent={<Feedback title={emptyTitle} message={emptyMessage} />}
|
|
29
|
+
renderItem={({ item }) => (
|
|
30
|
+
<FocusGroup direction="horizontal" remember>
|
|
31
|
+
<View style={styles.row}>
|
|
32
|
+
{item.entries.map((entry, index) => <View key={entry.id} style={[styles.item, { marginRight: index < columns - 1 ? 6 : 0 }]}><StoryCard item={entry} width={cardWidth} imageHeight={Math.round((cardWidth - 12) * 1.28)} /></View>)}
|
|
33
|
+
</View>
|
|
34
|
+
</FocusGroup>
|
|
35
|
+
)}
|
|
36
|
+
/>
|
|
37
|
+
</View>
|
|
38
|
+
</FocusGroup>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
grid: { flex: 1 },
|
|
44
|
+
content: { paddingHorizontal: 18, paddingTop: theme.spacing.sm, paddingBottom: theme.spacing.xl },
|
|
45
|
+
row: { flexDirection: 'row' },
|
|
46
|
+
item: { marginBottom: theme.spacing.md },
|
|
47
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ActivityIndicator, StyleSheet, Text, View, theme } from '@adelin/ui';
|
|
2
|
+
import { Platform } from '@adelin/device';
|
|
3
|
+
import Action from './Action';
|
|
4
|
+
|
|
5
|
+
export default function Feedback({ title, message, loading = false, onRetry }: {
|
|
6
|
+
title: string;
|
|
7
|
+
message: string;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
onRetry?: () => void;
|
|
10
|
+
}) {
|
|
11
|
+
return (
|
|
12
|
+
<View style={styles.panel}>
|
|
13
|
+
{loading === true ? <ActivityIndicator color={theme.colors.primary} /> : <View style={styles.rule} />}
|
|
14
|
+
<Text style={styles.title}>{title}</Text>
|
|
15
|
+
<Text style={styles.message}>{message}</Text>
|
|
16
|
+
{onRetry !== undefined && <View style={styles.action}><Action label="Try again" primary onPress={() => onRetry()} preferred /></View>}
|
|
17
|
+
</View>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
panel: { minHeight: 200, padding: theme.spacing.lg, justifyContent: 'center', alignItems: 'center' },
|
|
23
|
+
rule: { width: 28, height: 2, backgroundColor: theme.colors.primary },
|
|
24
|
+
title: { color: theme.colors.text, fontSize: Platform.select({ tv: 18, default: 24 }), lineHeight: Platform.select({ tv: 22, default: 30 }), fontWeight: '800', letterSpacing: -0.5, marginTop: theme.spacing.md, textAlign: 'center' },
|
|
25
|
+
message: { color: theme.colors.textSecondary, fontSize: Platform.select({ tv: 10, default: 15 }), lineHeight: Platform.select({ tv: 15, default: 22 }), fontWeight: '300', marginTop: theme.spacing.sm, textAlign: 'center', maxWidth: 420 },
|
|
26
|
+
action: { marginTop: theme.spacing.lg },
|
|
27
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StyleSheet, Text, TextInput, TVKeyboard, View, theme } from '@adelin/ui';
|
|
2
|
+
import { Platform } from '@adelin/device';
|
|
3
|
+
|
|
4
|
+
export default function Field({ label, value, onChangeText, secret = false, email = false, disabled = false }: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
onChangeText: (value: string) => void;
|
|
8
|
+
secret?: boolean;
|
|
9
|
+
email?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<View style={styles.field}>
|
|
14
|
+
<Text style={styles.label}>{label.toUpperCase()}</Text>
|
|
15
|
+
<TextInput value={value} onChangeText={onChangeText} accessibilityLabel={label} secureTextEntry={secret} keyboardType={email ? 'email-address' : 'default'} autoCapitalize="none" autoCorrect={false} editable={!disabled} style={({ focused }) => [styles.input, focused && styles.focused, disabled === true && styles.disabled]}
|
|
16
|
+
tvKeyboard={<TVKeyboard variant="bottom" style={styles.keyboard} keyStyle={styles.key} keyFocusedStyle={styles.keyFocused} keyLabelStyle={styles.keyLabel} keyLabelFocusedStyle={styles.keyLabelFocused} />}
|
|
17
|
+
/>
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const styles = StyleSheet.create({
|
|
23
|
+
field: { marginBottom: Platform.select({ tv: 12, default: 18 }) },
|
|
24
|
+
label: { color: theme.colors.textMuted, fontSize: Platform.select({ tv: 7, default: 11 }), lineHeight: Platform.select({ tv: 10, default: 15 }), fontWeight: '700', letterSpacing: 1.4, marginBottom: Platform.select({ tv: 4, default: 6 }) },
|
|
25
|
+
input: { color: theme.colors.text, backgroundColor: theme.colors.background, borderColor: theme.colors.border, borderWidth: 1, borderBottomWidth: 2, borderBottomColor: theme.colors.textMuted, paddingHorizontal: Platform.select({ tv: 10, default: 14 }), paddingVertical: Platform.select({ tv: 6, default: 10 }), fontSize: Platform.select({ tv: 11, default: 16 }), lineHeight: Platform.select({ tv: 16, default: 22 }), minHeight: Platform.select({ tv: 30, default: 48 }) },
|
|
26
|
+
focused: { borderColor: theme.colors.text, borderBottomColor: theme.colors.primary, backgroundColor: theme.colors.surface },
|
|
27
|
+
disabled: { opacity: 0.5 },
|
|
28
|
+
keyboard: { backgroundColor: theme.colors.surface, borderTopWidth: 1, borderTopColor: theme.colors.border },
|
|
29
|
+
key: { backgroundColor: theme.colors.background, borderWidth: 2, borderColor: 'transparent', borderRadius: 1 },
|
|
30
|
+
keyFocused: { backgroundColor: theme.colors.text, borderWidth: 2, borderColor: theme.colors.text, borderRadius: 1 },
|
|
31
|
+
keyLabel: { color: theme.colors.text },
|
|
32
|
+
keyLabelFocused: { color: theme.colors.surface },
|
|
33
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FlashList, FocusGroup, StyleSheet, Text, View, theme, useWindowDimensions } from '@adelin/ui';
|
|
2
|
+
import { Platform } from '@adelin/device';
|
|
3
|
+
import StoryCard from './StoryCard';
|
|
4
|
+
|
|
5
|
+
/** A section front: name, note and count in a left column on wide screens, story cards to the right. */
|
|
6
|
+
export default function LibraryRail({ title, note, entries, count = '', resume = false }: {
|
|
7
|
+
title: string;
|
|
8
|
+
note?: string;
|
|
9
|
+
entries: { id: string; kind?: string; title: string; description?: string; artwork: { backdrop?: string; poster?: string } }[];
|
|
10
|
+
count?: string;
|
|
11
|
+
resume?: boolean;
|
|
12
|
+
}) {
|
|
13
|
+
const { width, height } = useWindowDimensions();
|
|
14
|
+
const wide = width >= 840 && height >= 480;
|
|
15
|
+
if (entries.length === 0) return null;
|
|
16
|
+
return (
|
|
17
|
+
<View style={[styles.section, wide && styles.sectionWide]}>
|
|
18
|
+
<View style={[styles.heading, wide && styles.headingWide]}>
|
|
19
|
+
<Text style={[styles.title, wide && styles.titleWide]} numberOfLines={wide ? 3 : 1}>{title}</Text>
|
|
20
|
+
{!!note && <Text style={[styles.note, wide && styles.noteWide]} numberOfLines={wide ? 5 : 2}>{note}</Text>}
|
|
21
|
+
{wide && <Text style={styles.count}>{count.length > 0 ? count : entries.length === 1 ? '1 FILM' : entries.length + ' FILMS'}</Text>}
|
|
22
|
+
</View>
|
|
23
|
+
<FocusGroup direction="horizontal" remember>
|
|
24
|
+
<FlashList horizontal data={entries} keyExtractor={item => item.id} showsHorizontalScrollIndicator={false} focusEntry="remember" style={[styles.rail, wide && styles.railWide]} contentContainerStyle={[styles.railContent, wide && styles.railContentWide]}
|
|
25
|
+
renderItem={({ item }) => <View style={styles.item}><StoryCard item={item} resume={resume} /></View>}
|
|
26
|
+
/>
|
|
27
|
+
</FocusGroup>
|
|
28
|
+
</View>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const styles = StyleSheet.create({
|
|
33
|
+
section: { marginHorizontal: 18, paddingTop: 14, marginBottom: theme.spacing.md, borderTopWidth: 1, borderTopColor: theme.colors.border, flexDirection: 'column' },
|
|
34
|
+
sectionWide: { marginHorizontal: theme.spacing.lg, paddingTop: 10, marginBottom: 10, flexDirection: 'row' },
|
|
35
|
+
heading: { marginBottom: 4 },
|
|
36
|
+
headingWide: { width: 176, paddingRight: theme.spacing.md, paddingTop: 5, marginBottom: 0 },
|
|
37
|
+
title: { color: theme.colors.text, fontSize: 22, lineHeight: 27, fontWeight: '800', letterSpacing: -0.6 },
|
|
38
|
+
titleWide: { fontSize: 19, lineHeight: 21, fontWeight: '900', letterSpacing: -0.7 },
|
|
39
|
+
note: { color: theme.colors.textSecondary, fontSize: 14, lineHeight: 19, fontWeight: '300', marginTop: 2 },
|
|
40
|
+
noteWide: { fontSize: 9, lineHeight: 13, marginTop: 7 },
|
|
41
|
+
count: { color: theme.colors.primary, fontSize: 7, lineHeight: 10, fontWeight: '800', letterSpacing: 1.4, marginTop: 10 },
|
|
42
|
+
rail: { height: Platform.select({ tv: 206, default: 280 }), marginHorizontal: -6 },
|
|
43
|
+
railWide: { flex: 1, marginHorizontal: 0, marginRight: -theme.spacing.lg },
|
|
44
|
+
railContent: { paddingTop: Platform.select({ tv: 3, default: 6 }), paddingBottom: 3, paddingLeft: 3 },
|
|
45
|
+
railContentWide: { paddingRight: theme.spacing.lg },
|
|
46
|
+
item: { marginRight: Platform.select({ tv: 4, default: 4 }) },
|
|
47
|
+
});
|