Skip to content

Commit 8f2f78d

Browse files
committed
Mobile UI Improvements
1 parent 6d118d5 commit 8f2f78d

4 files changed

Lines changed: 188 additions & 54 deletions

File tree

src/components/MobileNav.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export function MobileNav({
315315
</Group>
316316

317317
<Group justify="center" p="xs" pb="md">
318-
<Text size="xs" c="dimmed">© 2023 Toolworks</Text>
318+
<Text size="xs" c="dimmed">© 2025 Toolworks.dev</Text>
319319
<Anchor
320320
href="https://github.com/toolworks-dev/trusty-notes"
321321
target="_blank"

src/components/NoteEditor.tsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export function NoteEditor({ note, isMobile = false, isKeyboardVisible = false,
3434
setContent(note.content || '');
3535
}, [note]);
3636

37-
// Initialize crypto if needed
3837
useEffect(() => {
3938
const initCrypto = async () => {
4039
try {
@@ -50,13 +49,9 @@ export function NoteEditor({ note, isMobile = false, isKeyboardVisible = false,
5049
initCrypto();
5150
}, []);
5251

53-
// Update the useEffect that handles body overflow
5452
useEffect(() => {
5553
if (isMobile) {
56-
// Prevent body scrolling when editor is open on mobile
5754
document.body.style.overflow = 'hidden';
58-
59-
// Add a class to help with mobile styling
6055
document.body.classList.add('editor-open');
6156

6257
return () => {
@@ -161,11 +156,12 @@ export function NoteEditor({ note, isMobile = false, isKeyboardVisible = false,
161156

162157
<Box className="editor-container" style={{
163158
flex: 1,
164-
border: '1px solid var(--mantine-color-gray-3)',
165-
borderRadius: '8px',
166159
overflow: 'hidden',
167160
backgroundColor: 'var(--mantine-color-body)',
168-
position: 'relative'
161+
position: 'relative',
162+
display: 'flex',
163+
flexDirection: 'column',
164+
paddingBottom: '70px'
169165
}}>
170166
<MarkdownEditor
171167
content={content}
@@ -256,17 +252,19 @@ export function NoteEditor({ note, isMobile = false, isKeyboardVisible = false,
256252
</Box>
257253
</>
258254
)}
259-
<Paper withBorder radius="md" p="md" mb="md">
260-
<Group justify="space-between">
261-
<Stack gap={4}>
262-
<Text size="sm" fw={500}>Last edited: {format(note.updated_at, 'MMM d, yyyy h:mm a')}</Text>
263-
{getEncryptionBadge()}
264-
</Stack>
265-
<ActionIcon color="red" onClick={handleDelete}>
266-
<IconTrash size={18} />
267-
</ActionIcon>
268-
</Group>
269-
</Paper>
255+
{!isMobile && (
256+
<Paper withBorder radius="md" p="md" mb="md">
257+
<Group justify="space-between">
258+
<Stack gap={4}>
259+
<Text size="sm" fw={500}>Last edited: {format(note.updated_at, 'MMM d, yyyy h:mm a')}</Text>
260+
{getEncryptionBadge()}
261+
</Stack>
262+
<ActionIcon color="red" onClick={handleDelete}>
263+
<IconTrash size={18} />
264+
</ActionIcon>
265+
</Group>
266+
</Paper>
267+
)}
270268
</Box>
271269
);
272270
}

src/components/RichTextEditor.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
IconH1,
2626
IconH2,
2727
} from '@tabler/icons-react';
28-
import { useEffect, useState } from 'react';
28+
import { useEffect, useState, CSSProperties } from 'react';
2929

3030
const tableStyles = {
3131
'.ProseMirror': {
@@ -272,6 +272,23 @@ export function RichTextEditor({ content, onChange, isMobile }: RichTextEditorPr
272272
</Box>
273273
);
274274

275+
const mobileBorderStyle: CSSProperties = isMobile ? {
276+
borderLeft: '1px solid var(--mantine-color-gray-3)',
277+
borderRight: '1px solid var(--mantine-color-gray-3)',
278+
borderBottom: '1px solid var(--mantine-color-gray-3)',
279+
borderTop: 'none',
280+
borderRadius: '8px',
281+
padding: '1rem',
282+
overflow: 'hidden',
283+
flex: 1
284+
} : {
285+
border: '1px solid var(--mantine-color-gray-3)',
286+
borderRadius: 'var(--mantine-radius-md)',
287+
padding: '1rem',
288+
overflow: 'hidden',
289+
flex: 1
290+
};
291+
275292
return (
276293
<Box style={{
277294
display: 'flex',
@@ -332,12 +349,9 @@ export function RichTextEditor({ content, onChange, isMobile }: RichTextEditorPr
332349
flex: '1 1 auto',
333350
display: 'flex',
334351
flexDirection: 'column',
335-
border: '1px solid var(--mantine-color-gray-3)',
336-
borderRadius: 'var(--mantine-radius-md)',
337-
padding: '1rem',
338-
overflow: 'hidden',
339352
minHeight: 0,
340353
...tableStyles,
354+
...mobileBorderStyle
341355
}}
342356
>
343357
<EditorContent

0 commit comments

Comments
 (0)