feat(notes): support mobile all-workspace view
This commit is contained in:
parent
6c14b6b696
commit
7d23793728
@ -21,7 +21,9 @@ export default function CaptureScreen() {
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>Quick capture</Text>
|
||||
<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>
|
||||
<View style={styles.workspaceRow}>
|
||||
{workspaces.map((workspace: MobileWorkspace) => {
|
||||
@ -72,9 +74,10 @@ export default function CaptureScreen() {
|
||||
setTitle('');
|
||||
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>
|
||||
{saved ? <Text style={styles.saved}>Draft saved to the product backend.</Text> : null}
|
||||
<View style={styles.card}>
|
||||
@ -125,6 +128,9 @@ const styles = StyleSheet.create({
|
||||
color: colors.textPrimary,
|
||||
fontWeight: '700',
|
||||
},
|
||||
buttonDisabled: {
|
||||
opacity: 0.6,
|
||||
},
|
||||
saved: {
|
||||
color: colors.success,
|
||||
fontSize: 14,
|
||||
|
||||
@ -40,6 +40,14 @@ export default function HomeScreen() {
|
||||
<Text style={styles.summaryMeta}>{visibleCount} visible notes ready for quick retrieval</Text>
|
||||
</View>
|
||||
<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) => {
|
||||
const isActive = workspace.id === activeWorkspaceId;
|
||||
|
||||
|
||||
@ -5,20 +5,26 @@ export type WorkspaceState = {
|
||||
workspaces: MobileWorkspace[];
|
||||
activeWorkspaceId: string | null;
|
||||
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: [],
|
||||
activeWorkspaceId: null,
|
||||
async hydrate() {
|
||||
const workspaces = await listWorkspaces();
|
||||
const currentActiveWorkspaceId = get().activeWorkspaceId;
|
||||
set({
|
||||
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 });
|
||||
},
|
||||
}));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user