feat(notes): support mobile all-workspace view

This commit is contained in:
saravanakumardb1 2026-03-10 17:09:16 -07:00
parent 6c14b6b696
commit 7d23793728
3 changed files with 27 additions and 7 deletions

View File

@ -21,7 +21,9 @@ export default function CaptureScreen() {
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.title}>Quick capture</Text> <Text style={styles.title}>Quick capture</Text>
<Text style={styles.subtitle}> <Text style={styles.subtitle}>
Create a lightweight mobile draft in {activeWorkspaceName}. Offline queue wiring comes in a later batch. {activeWorkspaceId
? `Create a lightweight mobile draft in ${activeWorkspaceName}. Offline queue wiring comes in a later batch.`
: 'Choose a workspace to save this mobile draft. Offline queue wiring comes in a later batch.'}
</Text> </Text>
<View style={styles.workspaceRow}> <View style={styles.workspaceRow}>
{workspaces.map((workspace: MobileWorkspace) => { {workspaces.map((workspace: MobileWorkspace) => {
@ -72,9 +74,10 @@ export default function CaptureScreen() {
setTitle(''); setTitle('');
setBody(''); setBody('');
}} }}
style={styles.button} disabled={!activeWorkspaceId}
style={[styles.button, !activeWorkspaceId ? styles.buttonDisabled : null]}
> >
<Text style={styles.buttonText}>Save draft</Text> <Text style={styles.buttonText}>{activeWorkspaceId ? 'Save draft' : 'Select workspace'}</Text>
</Pressable> </Pressable>
{saved ? <Text style={styles.saved}>Draft saved to the product backend.</Text> : null} {saved ? <Text style={styles.saved}>Draft saved to the product backend.</Text> : null}
<View style={styles.card}> <View style={styles.card}>
@ -125,6 +128,9 @@ const styles = StyleSheet.create({
color: colors.textPrimary, color: colors.textPrimary,
fontWeight: '700', fontWeight: '700',
}, },
buttonDisabled: {
opacity: 0.6,
},
saved: { saved: {
color: colors.success, color: colors.success,
fontSize: 14, fontSize: 14,

View File

@ -40,6 +40,14 @@ export default function HomeScreen() {
<Text style={styles.summaryMeta}>{visibleCount} visible notes ready for quick retrieval</Text> <Text style={styles.summaryMeta}>{visibleCount} visible notes ready for quick retrieval</Text>
</View> </View>
<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.workspaceRow}> <ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.workspaceRow}>
<Pressable
onPress={() => setActiveWorkspace(null)}
style={[styles.workspaceChip, activeWorkspaceId === null ? styles.workspaceChipActive : null]}
>
<Text style={[styles.workspaceChipText, activeWorkspaceId === null ? styles.workspaceChipTextActive : null]}>
All
</Text>
</Pressable>
{workspaces.map((workspace: MobileWorkspace) => { {workspaces.map((workspace: MobileWorkspace) => {
const isActive = workspace.id === activeWorkspaceId; const isActive = workspace.id === activeWorkspaceId;

View File

@ -5,20 +5,26 @@ export type WorkspaceState = {
workspaces: MobileWorkspace[]; workspaces: MobileWorkspace[];
activeWorkspaceId: string | null; activeWorkspaceId: string | null;
hydrate: () => Promise<void>; hydrate: () => Promise<void>;
setActiveWorkspace: (id: string) => void; setActiveWorkspace: (id: string | null) => void;
}; };
export const useWorkspaceStore = create<WorkspaceState>((set) => ({ export const useWorkspaceStore = create<WorkspaceState>((set, get) => ({
workspaces: [], workspaces: [],
activeWorkspaceId: null, activeWorkspaceId: null,
async hydrate() { async hydrate() {
const workspaces = await listWorkspaces(); const workspaces = await listWorkspaces();
const currentActiveWorkspaceId = get().activeWorkspaceId;
set({ set({
workspaces, workspaces,
activeWorkspaceId: workspaces[0]?.id ?? null, activeWorkspaceId:
currentActiveWorkspaceId === null
? null
: workspaces.some((workspace) => workspace.id === currentActiveWorkspaceId)
? currentActiveWorkspaceId
: workspaces[0]?.id ?? null,
}); });
}, },
setActiveWorkspace(id: string) { setActiveWorkspace(id: string | null) {
set({ activeWorkspaceId: id }); set({ activeWorkspaceId: id });
}, },
})); }));