Skip to content
Open
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
12 changes: 6 additions & 6 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Tabs } from "expo-router";
import { Platform } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";

import { HapticTab } from "../../components/haptic-tab";
import { IconSymbol } from "@/components/ui/icon-symbol";
import { palette } from "@/constants/commander";
import { Platform } from "react-native";
import { design } from "@/constants/design-system";
import { useColors } from "@/hooks/use-colors";

export default function TabLayout() {
Expand All @@ -20,14 +20,14 @@ export default function TabLayout() {
headerShown: false,
tabBarButton: HapticTab,
tabBarHideOnKeyboard: true,
tabBarLabelStyle: { fontSize: 10, fontWeight: "800", letterSpacing: 0.2 },
tabBarItemStyle: { borderRadius: 12, marginHorizontal: 2, marginVertical: 4 },
tabBarActiveBackgroundColor: palette.orangeSoft,
tabBarLabelStyle: { fontSize: design.type.eyebrow, fontWeight: "800", letterSpacing: 0.2 },
tabBarItemStyle: { borderRadius: design.radius.md, marginHorizontal: 2, marginVertical: 4 },
tabBarActiveBackgroundColor: design.color.orangeSoft,
tabBarStyle: {
paddingTop: 6,
paddingBottom: bottomPadding,
height: tabBarHeight,
backgroundColor: palette.paper,
backgroundColor: design.color.surface,
borderTopColor: colors.border,
borderTopWidth: 1,
},
Expand Down
60 changes: 60 additions & 0 deletions components/commander-state-notice.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { StyleSheet, Text, View } from "react-native";

import { design } from "@/constants/design-system";

type CommanderStateNoticeProps = {
title: string;
detail: string;
kind?: "info" | "warning" | "error";
footer?: string;
};

const kindColors = {
info: { accent: design.color.navy, background: "#E9EFF0" },
warning: { accent: design.color.yellow, background: design.color.yellowSoft },
error: { accent: design.color.red, background: "#FCECEB" },
} as const;

/** Use for empty, permission-denied, unsupported, and recoverable-error states. */
export function CommanderStateNotice({
title,
detail,
kind = "info",
footer,
}: CommanderStateNoticeProps) {
const colors = kindColors[kind];

return (
<View
accessibilityRole="summary"
style={[styles.container, { backgroundColor: colors.background, borderLeftColor: colors.accent }]}
>
<Text style={[styles.title, { color: colors.accent }]}>{title}</Text>
<Text style={styles.detail}>{detail}</Text>
{footer ? <Text style={styles.footer}>{footer}</Text> : null}
</View>
);
}

const styles = StyleSheet.create({
container: {
borderLeftWidth: 3,
borderRadius: design.radius.md,
padding: design.space.md,
gap: design.space.xs,
},
title: {
fontSize: design.type.body,
fontWeight: "800",
},
detail: {
color: design.color.text,
fontSize: design.type.caption,
lineHeight: 17,
},
footer: {
color: design.color.textMuted,
fontSize: design.type.caption,
lineHeight: 16,
},
});
42 changes: 42 additions & 0 deletions components/commander-status-badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { StyleSheet, Text, View } from "react-native";

import { design, type DesignStatus } from "@/constants/design-system";

type CommanderStatusBadgeProps = {
status: DesignStatus;
label?: string;
accessibilityLabel?: string;
};

export function CommanderStatusBadge({
status,
label,
accessibilityLabel,
}: CommanderStatusBadgeProps) {
const token = design.status[status];
const visibleLabel = label ?? token.label;

return (
<View
accessibilityRole="text"
accessibilityLabel={accessibilityLabel ?? visibleLabel}
style={[styles.badge, { backgroundColor: token.background }]}
>
<Text style={[styles.label, { color: token.foreground }]}>{visibleLabel}</Text>
</View>
);
}

const styles = StyleSheet.create({
badge: {
alignSelf: "flex-start",
borderRadius: design.radius.sm,
paddingHorizontal: design.space.xs,
paddingVertical: 5,
},
label: {
fontSize: design.type.eyebrow,
fontWeight: "900",
letterSpacing: 0.5,
},
});
52 changes: 52 additions & 0 deletions constants/design-system.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { palette } from "@/constants/commander";

/**
* Shared visual contract for Droid Commander.
* Keep screen styling consistent; do not use color alone to communicate status.
*/
export const design = {
color: {
...palette,
background: palette.canvas,
surface: palette.paper,
surfaceSubtle: "#EEF2F1",
text: palette.ink,
textMuted: palette.muted,
border: palette.line,
accent: palette.orange,
},
space: {
xxs: 4,
xs: 8,
sm: 12,
md: 16,
lg: 20,
xl: 24,
xxl: 32,
},
radius: {
sm: 8,
md: 12,
card: 16,
panel: 20,
pill: 999,
},
type: {
eyebrow: 10,
caption: 11,
body: 14,
bodyLineHeight: 20,
section: 18,
title: 30,
},
status: {
critical: { foreground: palette.red, background: "#FCECEB", label: "CRITICAL" },
review: { foreground: palette.yellow, background: palette.yellowSoft, label: "REVIEW" },
clear: { foreground: palette.green, background: palette.greenSoft, label: "CLEAR" },
limited: { foreground: palette.muted, background: "#EEF1F1", label: "LIMITED" },
demo: { foreground: palette.navy, background: "#E9EFF0", label: "DEMO" },
unavailable: { foreground: palette.muted, background: "#EEF1F1", label: "UNAVAILABLE" },
},
} as const;

export type DesignStatus = keyof typeof design.status;
Loading