Skip to content

Commit bba1290

Browse files
authored
merge: pull request #14 from 0xN1/feat-mobile-v01
feat: mobile design
2 parents c602ef8 + cc57e5b commit bba1290

15 files changed

+220
-108
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ A personal journal app where we keep the data locally, while having the power to
2222

2323
- [x] Option to use OpenAI API
2424
- [x] Model selection for OpenAI
25-
- [ ] Mobile responsive design
25+
- [x] Mobile responsive design
2626
- [ ] Allow ollama model pull from within the app
2727
- [ ] Allow theme customization
2828
- [ ] Support markdown

bun.lockb

420 Bytes
Binary file not shown.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kisahari",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
@@ -18,6 +18,7 @@
1818
"@radix-ui/react-select": "^2.0.0",
1919
"@radix-ui/react-slot": "^1.0.2",
2020
"@radix-ui/react-toast": "^1.1.5",
21+
"caniuse-lite": "^1.0.30001702",
2122
"class-variance-authority": "^0.7.0",
2223
"clsx": "^2.1.0",
2324
"dexie": "^3.2.5",

src/app/globals.css

+39-18
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4-
4+
55
@layer base {
66
:root {
77
--background: 0 0% 100%;
88
--foreground: 0 0% 3.9%;
99

1010
--card: 0 0% 100%;
1111
--card-foreground: 0 0% 3.9%;
12-
12+
1313
--popover: 0 0% 100%;
1414
--popover-foreground: 0 0% 3.9%;
15-
15+
1616
--primary: 0 0% 9%;
1717
--primary-foreground: 0 0% 98%;
18-
18+
1919
--secondary: 0 0% 96.1%;
2020
--secondary-foreground: 0 0% 9%;
21-
21+
2222
--muted: 0 0% 96.1%;
2323
--muted-foreground: 0 0% 45.1%;
24-
24+
2525
--accent: 0 0% 96.1%;
2626
--accent-foreground: 0 0% 9%;
27-
27+
2828
--destructive: 0 84.2% 60.2%;
2929
--destructive-foreground: 0 0% 98%;
3030

3131
--border: 0 0% 89.8%;
3232
--input: 0 0% 89.8%;
3333
--ring: 0 0% 3.9%;
34-
34+
3535
--radius: 0.5rem;
3636
}
37-
37+
3838
.dark {
3939
--background: 0 0% 3.9%;
4040
--foreground: 0 0% 98%;
41-
41+
4242
--card: 0 0% 3.9%;
4343
--card-foreground: 0 0% 98%;
44-
44+
4545
--popover: 0 0% 3.9%;
4646
--popover-foreground: 0 0% 98%;
47-
47+
4848
--primary: 0 0% 98%;
4949
--primary-foreground: 0 0% 9%;
50-
50+
5151
--secondary: 0 0% 14.9%;
5252
--secondary-foreground: 0 0% 98%;
53-
53+
5454
--muted: 0 0% 14.9%;
5555
--muted-foreground: 0 0% 63.9%;
56-
56+
5757
--accent: 0 0% 14.9%;
5858
--accent-foreground: 0 0% 98%;
59-
59+
6060
--destructive: 0 62.8% 30.6%;
6161
--destructive-foreground: 0 0% 98%;
62-
62+
6363
--border: 0 0% 14.9%;
6464
--input: 0 0% 14.9%;
6565
--ring: 0 0% 83.1%;
6666
}
6767
}
68-
68+
6969
@layer base {
7070
* {
7171
@apply border-border;
@@ -74,3 +74,24 @@
7474
@apply bg-background text-foreground;
7575
}
7676
}
77+
78+
/* Mobile responsive adjustments */
79+
@media (max-width: 640px) {
80+
.prose {
81+
font-size: 0.875rem;
82+
}
83+
84+
input,
85+
textarea,
86+
select,
87+
button {
88+
font-size: 0.875rem;
89+
}
90+
}
91+
92+
/* Ensure content doesn't overflow on small screens */
93+
html,
94+
body {
95+
max-width: 100vw;
96+
overflow-x: hidden;
97+
}

src/app/home.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import useLocalStorage from "@/hooks/use-local-storage";
1818

1919
const data = {
2020
title: "KISAHARI",
21-
version: "v030",
21+
version: "v040",
2222
footer: {
2323
left_copy: "YOUR PERSONAL JOURNAL",
24-
right_copy: "KISAHARI © 2024",
24+
right_copy: "KISAHARI © ",
2525
},
2626
};
2727

src/components/current-time.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const CurrentTime = (props: Props) => {
1515
}, 1000);
1616
return () => clearInterval(interval);
1717
});
18-
return <div>{currentTime}</div>;
18+
return <div className="text-xs sm:text-sm">{currentTime}</div>;
1919
};
2020

2121
export default CurrentTime;

src/components/home/ai-button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const AIButton = ({
99
setShowAI: (showAI: boolean) => void;
1010
}) => {
1111
return (
12-
<div className="absolute right-8 top-[14vh]">
12+
<div className="absolute right-2 sm:right-4 md:right-8 sm:top-[14vh] top-[9vh]">
1313
<button
1414
onClick={() => {
1515
setShowAI(!showAI);

src/components/home/ai-chat.tsx

+15-11
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,28 @@ const AIChat = ({
1818
setLoading: (loading: boolean) => void;
1919
}) => {
2020
return (
21-
<div className="absolute inset-0 flex flex-col items-end justify-start top-[11vh] py-2 px-16 pointer-events-none">
22-
<div className="px-4 py-2 rounded-md flex flex-col justify-evenly items-center w-full max-w-md pointer-events-auto">
21+
<div
22+
className="absolute inset-0 flex flex-col items-end justify-start top-[10vh] sm:top-[11vh] py-2 px-2 sm:px-4 md:px-16 pointer-events-none
23+
from-zinc-900 to-zinc-950/20 bg-gradient-to-b mx-2 sm:mx-0 sm:bg-transparent
24+
[background:radial-gradient(200%_150%_at_50%_15%,#111_25%,#7d11_100%)] sm:[background:none]"
25+
>
26+
<div className="px-2 sm:px-4 py-2 rounded-md flex flex-col justify-evenly items-center w-full max-w-full sm:max-w-md pointer-events-auto">
2327
<form
24-
className="w-full p-4"
28+
className="w-full p-2 sm:p-4"
2529
onSubmit={(e) => {
2630
e.preventDefault();
2731
askLLM(new FormData(e.target as HTMLFormElement));
2832
}}
2933
>
30-
<div className="flex flex-row w-full gap-4 justify-between">
34+
<div className="flex flex-row w-full gap-2 sm:gap-4 justify-between">
3135
<input
3236
autoFocus
3337
type="text"
3438
name="q"
3539
autoComplete="off"
3640
minLength={1}
3741
placeholder="Ask me anything"
38-
className="max-w-prose w-full text-xs bg-transparent focus:outline-none break-words ring-zinc-400 ring-1 px-3 py-2 rounded-lg"
42+
className="max-w-prose w-full text-xs bg-transparent focus:outline-none break-words ring-zinc-400 ring-1 px-2 sm:px-3 py-2 rounded-lg"
3943
/>
4044
<button
4145
onClick={() => {
@@ -44,7 +48,7 @@ const AIChat = ({
4448
}}
4549
type="reset"
4650
>
47-
<RotateCcwIcon className="w-5 h-5 text-zinc-600 hover:text-zinc-300" />
51+
<RotateCcwIcon className="w-4 h-4 sm:w-5 sm:h-5 text-zinc-600 hover:text-zinc-300" />
4852
</button>
4953
<button
5054
onClick={() => {
@@ -55,28 +59,28 @@ const AIChat = ({
5559
type="submit"
5660
>
5761
{!loading ? (
58-
<SparklesIcon className="w-5 h-5 text-zinc-300 hover:text-lime-500" />
62+
<SparklesIcon className="w-4 h-4 sm:w-5 sm:h-5 text-zinc-300 hover:text-lime-500" />
5963
) : (
60-
<Loader2Icon className="w-5 h-5 text-zinc-300 hover:text-lime-500 animate-spin" />
64+
<Loader2Icon className="w-4 h-4 sm:w-5 sm:h-5 text-zinc-300 hover:text-lime-500 animate-spin" />
6165
)}
6266
</button>
6367
</div>
6468
</form>
6569

6670
{answer.length > 1 && (
67-
<div className="whitespace-pre-line self-start prose prose-zinc break-words max-w-prose max-h-[50vh] overflow-y-scroll scrollbar-thin scrollbar-thumb-lime-500 scrollbar-track-transparent text-sm text-zinc-300 p-4">
71+
<div className="whitespace-pre-line self-start prose prose-zinc break-words max-w-prose max-h-[40vh] sm:max-h-[50vh] overflow-y-scroll scrollbar-thin scrollbar-thumb-lime-500 scrollbar-track-transparent text-xs sm:text-sm text-zinc-300 p-2 sm:p-4">
6872
{answer}
6973
</div>
7074
)}
7175
{loading && (
72-
<div className="max-w-prose text-xs self-start text-zinc-500 p-4 ">
76+
<div className="max-w-prose text-xs self-start text-zinc-500 p-2 sm:p-4">
7377
<div className="animate-pulse uppercase">
7478
{answer.length < 1 ? "thinking" : "streaming answers"}
7579
</div>
7680
</div>
7781
)}
7882
{time && (
79-
<div className="max-w-prose self-start text-xs text-zinc-500 p-4">
83+
<div className="max-w-prose self-start text-xs text-zinc-500 p-2 sm:p-4">
8084
<div className="">{time}</div>
8185
</div>
8286
)}

src/components/home/container.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const Container = ({
1010
return (
1111
<main
1212
className={cn(
13-
"flex relative flex-col min-h-screen items-center justify-between w-full h-full p-8 bg-zinc-100/15 dark:bg-zinc-900/10 font-extralight z-10 max-h-screen",
13+
"flex relative flex-col min-h-screen items-center justify-between w-full h-full p-2 sm:p-4 md:p-8 bg-zinc-100/15 dark:bg-zinc-900/10 font-extralight z-10 max-h-screen",
1414
className
1515
)}
1616
>

src/components/home/day-progress.tsx

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { cn } from "@/lib/utils";
2+
import { useEffect, useState } from "react";
23

34
const DayProgress = () => {
5+
const [progressWidth, setProgressWidth] = useState(0);
6+
47
const calcDayProgress = () => {
58
const now = new Date();
69
const start = new Date(now.getFullYear(), 0, 0);
@@ -12,21 +15,31 @@ const DayProgress = () => {
1215
return (day / daysInYear) * 100;
1316
};
1417

18+
useEffect(() => {
19+
setProgressWidth(calcDayProgress());
20+
21+
const interval = setInterval(() => {
22+
setProgressWidth(calcDayProgress());
23+
}, 60000);
24+
25+
return () => clearInterval(interval);
26+
}, []);
27+
1528
return (
1629
<div className="w-full relative flex flex-row text-xs justify-between items-center">
17-
<div
18-
className={cn(
19-
"flex flex-row self-start max-w-[95vw] py-2 px-4 bg-lime-400 rounded-[2px] text-zinc-800",
20-
`w-[${calcDayProgress()}vw]`
21-
)}
22-
></div>
30+
<div className="w-full bg-zinc-800 h-3 sm:h-6 rounded-[2px] overflow-hidden">
31+
<div
32+
className="h-full bg-lime-400 rounded-[2px] text-zinc-800 transition-width duration-300"
33+
style={{ width: `${progressWidth}%` }}
34+
></div>
35+
</div>
2336
<span
2437
className={cn(
25-
calcDayProgress() > 92 ? "text-zinc-800" : "text-lime-400",
26-
"absolute right-6 font-medium text-[0.9em]"
38+
progressWidth > 92 ? "text-zinc-800" : "text-lime-400",
39+
"absolute right-2 sm:right-4 md:right-6 font-medium text-[0.9em]"
2740
)}
2841
>
29-
{calcDayProgress().toFixed(1)}%
42+
{progressWidth.toFixed(1)}%
3043
</span>
3144
</div>
3245
);

src/components/home/entries-container.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const EntriesContainer = ({ children }: { children: React.ReactNode }) => {
22
return (
33
<div
4-
className="flex-1 relative h-full flex flex-col gap-4 p-8 sm:p-16 items-start w-full ring-1 ring-zinc-700
5-
overflow-y-auto max-h-[82vh] rounded-sm scrollbar-thin scrollbar-thumb-zinc-800 scrollbar-track-transparent"
4+
className="flex-1 relative h-full flex flex-col gap-0 sm:gap-4 p-2 sm:p-4 md:p-8 lg:p-16 pt-[14vh] sm:pt-0 items-start w-full ring-1 ring-zinc-700
5+
overflow-y-auto max-h-[85vh] sm:max-h-[78vh] md:max-h-[82vh] rounded-sm scrollbar-thin scrollbar-thumb-zinc-800 scrollbar-track-transparent"
66
>
77
{children}
88
</div>

0 commit comments

Comments
 (0)