Skip to content

Commit 6695031

Browse files
authored
Merge pull request anomalyco#171 from gergesh/feat/mobile-ui
2 parents 4ef63ed + bb8cfa9 commit 6695031

12 files changed

Lines changed: 728 additions & 30 deletions

File tree

‎bun.lock‎

Lines changed: 334 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/desktop/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"typescript": "catalog:",
2727
"vite": "catalog:",
2828
"vite-plugin-icons-spritesheet": "3.0.1",
29+
"vite-plugin-pwa": "0.21.1",
2930
"vite-plugin-solid": "catalog:"
3031
},
3132
"dependencies": {

‎packages/desktop/src/components/font-picker.tsx‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createMemo, createSignal, onMount } from "solid-js"
1+
import { createMemo, createSignal, onMount, Show } from "solid-js"
22
import { Button } from "@opencode-ai/ui/button"
33
import { Icon } from "@opencode-ai/ui/icon"
44
import { Tooltip } from "@opencode-ai/ui/tooltip"
@@ -58,7 +58,7 @@ function DialogSelectFont(props: { originalFont: string }) {
5858
)
5959
}
6060

61-
export function FontPicker() {
61+
export function FontPicker(props: { class?: string; mobile?: boolean }) {
6262
const layout = useLayout()
6363
const dialog = useDialog()
6464
const currentFont = createMemo(() => getFontById(layout.font.current()) ?? FONTS[0])
@@ -74,10 +74,25 @@ export function FontPicker() {
7474
}
7575

7676
return (
77-
<Tooltip class="shrink-0" value="Font">
78-
<Button variant="ghost" class="size-6 p-0" onClick={openDialog}>
79-
<Icon name="code-lines" size="small" />
77+
<Show
78+
when={props.mobile}
79+
fallback={
80+
<Tooltip class={`shrink-0 ${props.class ?? ""}`} value="Font">
81+
<Button variant="ghost" class="size-6 p-0" onClick={openDialog}>
82+
<Icon name="code-lines" size="small" />
83+
</Button>
84+
</Tooltip>
85+
}
86+
>
87+
<Button
88+
variant="ghost"
89+
size="large"
90+
class="w-full justify-start gap-3 px-2"
91+
icon="code-lines"
92+
onClick={openDialog}
93+
>
94+
<span class="text-14-medium text-text-strong">Font</span>
8095
</Button>
81-
</Tooltip>
96+
</Show>
8297
)
8398
}

‎packages/desktop/src/components/theme-picker.tsx‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createMemo, createSignal, onMount } from "solid-js"
1+
import { createMemo, createSignal, onMount, Show } from "solid-js"
22
import { Button } from "@opencode-ai/ui/button"
33
import { Icon } from "@opencode-ai/ui/icon"
44
import { Tooltip } from "@opencode-ai/ui/tooltip"
@@ -49,7 +49,7 @@ function DialogSelectTheme(props: { originalTheme: string }) {
4949
)
5050
}
5151

52-
export function ThemePicker() {
52+
export function ThemePicker(props: { class?: string; mobile?: boolean }) {
5353
const layout = useLayout()
5454
const dialog = useDialog()
5555
const currentTheme = createMemo(() => getThemeById(layout.theme.current()))
@@ -65,10 +65,19 @@ export function ThemePicker() {
6565
}
6666

6767
return (
68-
<Tooltip class="shrink-0" value="Theme">
69-
<Button variant="ghost" class="size-6 p-0" onClick={openDialog}>
70-
<Icon name="glasses" size="small" />
68+
<Show
69+
when={props.mobile}
70+
fallback={
71+
<Tooltip class={`shrink-0 ${props.class ?? ""}`} value="Theme">
72+
<Button variant="ghost" class="size-6 p-0" onClick={openDialog}>
73+
<Icon name="glasses" size="small" />
74+
</Button>
75+
</Tooltip>
76+
}
77+
>
78+
<Button variant="ghost" size="large" class="w-full justify-start gap-3 px-2" icon="glasses" onClick={openDialog}>
79+
<span class="text-14-medium text-text-strong">Theme</span>
7180
</Button>
72-
</Tooltip>
81+
</Show>
7382
)
7483
}

‎packages/desktop/src/index.css‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,106 @@
44
/* Font is set via JavaScript in index.html and font-picker.tsx */
55
/* Default fallback handled in inline script */
66

7+
/* Safe area insets for mobile devices (notch, home indicator, etc.) */
8+
--safe-area-inset-top: env(safe-area-inset-top, 0px);
9+
--safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
10+
--safe-area-inset-left: env(safe-area-inset-left, 0px);
11+
--safe-area-inset-right: env(safe-area-inset-right, 0px);
12+
713
a {
814
cursor: default;
915
}
1016
}
1117

18+
/* Mobile breakpoint: 40rem = 640px */
1219
@media (max-width: 40rem) {
20+
/* Prevent zoom on input focus */
1321
input,
1422
textarea,
1523
select,
1624
button,
1725
[contenteditable] {
1826
font-size: 16px;
1927
}
28+
29+
/* Full-screen dialogs on mobile */
30+
[data-component="dialog"] {
31+
margin-left: 0 !important;
32+
padding: var(--safe-area-inset-top) var(--safe-area-inset-right) var(--safe-area-inset-bottom)
33+
var(--safe-area-inset-left);
34+
35+
[data-slot="dialog-container"] {
36+
width: 100% !important;
37+
height: 100% !important;
38+
max-width: 100% !important;
39+
max-height: 100% !important;
40+
41+
&[data-size="sm"],
42+
&[data-size="md"],
43+
&[data-size="lg"] {
44+
width: 100% !important;
45+
height: 100% !important;
46+
max-width: 100% !important;
47+
max-height: 100% !important;
48+
}
49+
50+
[data-slot="dialog-content"] {
51+
border-radius: 0;
52+
border: none;
53+
min-height: 100%;
54+
height: 100%;
55+
}
56+
}
57+
}
58+
59+
/* Adjust sidebar behavior - always collapsed on mobile */
60+
[data-component="sidebar"] {
61+
position: fixed;
62+
z-index: 40;
63+
transform: translateX(-100%);
64+
transition: transform 0.2s ease-out;
65+
66+
&[data-open="true"] {
67+
transform: translateX(0);
68+
}
69+
}
70+
71+
/* Mobile header adjustments */
72+
header[data-tauri-drag-region] {
73+
padding-top: var(--safe-area-inset-top);
74+
}
75+
}
76+
77+
/* PWA standalone mode specific styles */
78+
@media (display-mode: standalone) {
79+
:root {
80+
/* When running as PWA, ensure we account for device UI */
81+
--pwa-top-offset: var(--safe-area-inset-top);
82+
--pwa-bottom-offset: var(--safe-area-inset-bottom);
83+
}
84+
85+
/* Ensure the app fills the screen properly in PWA mode */
86+
#root {
87+
min-height: 100vh;
88+
min-height: -webkit-fill-available;
89+
min-height: 100dvh;
90+
}
91+
}
92+
93+
/* Touch-friendly improvements */
94+
@media (pointer: coarse) {
95+
/* Larger touch targets */
96+
button,
97+
[role="button"],
98+
a {
99+
min-height: 44px;
100+
min-width: 44px;
101+
}
102+
103+
/* Exception for inline/small buttons that are part of larger components */
104+
[data-slot="icon-button"],
105+
[data-component="icon-button"] {
106+
min-height: 32px;
107+
min-width: 32px;
108+
}
20109
}

‎packages/desktop/src/pages/home.tsx‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ export default function Home() {
3939
}
4040

4141
return (
42-
<div class="size-full bg-background-base flex flex-col items-center pt-55">
43-
<AsciiLogo scale={1.5} class="opacity-30 max-[40rem]:scale-[0.85] max-[40rem]:origin-center" />
42+
<div class="size-full bg-background-base flex flex-col items-center pt-20 sm:pt-55 pb-safe-bottom">
43+
<AsciiLogo scale={1.5} class="opacity-30 max-[40rem]:scale-75 max-[40rem]:origin-center" />
4444
<Switch>
4545
<Match when={sync.data.project.length > 0}>
46-
<div class="mt-20 w-full max-w-xl flex flex-col gap-4 px-3">
47-
<div class="flex gap-2 items-center justify-between">
46+
<div class="mt-10 sm:mt-20 w-full max-w-xl flex flex-col gap-4 px-4 sm:px-3">
47+
<div class="flex gap-2 items-center justify-between flex-wrap">
4848
<div class="text-14-medium text-text-strong">Recent projects</div>
4949
<div class="flex gap-2">
5050
<Button
@@ -53,11 +53,13 @@ export default function Home() {
5353
class="pl-2 pr-3"
5454
onClick={() => dialog.show(() => <DialogCreateProject />)}
5555
>
56-
Create project
56+
<span class="hidden sm:inline">Create project</span>
57+
<span class="sm:hidden">Create</span>
5758
</Button>
5859
<Show when={platform.openDirectoryPickerDialog}>
5960
<Button icon="folder-add-left" size="normal" class="pl-2 pr-3" onClick={chooseProject}>
60-
Open project
61+
<span class="hidden sm:inline">Open project</span>
62+
<span class="sm:hidden">Open</span>
6163
</Button>
6264
</Show>
6365
</div>

0 commit comments

Comments
 (0)