Skip to content

Commit 23b506c

Browse files
authored
Merge pull request #39 from mpc-ou/issue-33
style: fix ui
2 parents 48f4855 + 4d0f8bd commit 23b506c

4 files changed

Lines changed: 22 additions & 18 deletions

File tree

assets/globals.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,10 @@
120120
body {
121121
@apply bg-background text-foreground;
122122
}
123+
124+
/* Prevent Radix from locking scroll and shifting layout */
125+
body[data-scroll-locked] {
126+
overflow: visible !important;
127+
margin-right: 0 !important;
128+
}
123129
}

entrypoints/popup/InfoTab/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CircleAlertIcon, CircleCheckIcon, FileOutputIcon, ImportIcon } from "lucide-react";
2-
import { Activity, useEffect, useLayoutEffect } from "react";
2+
import { Activity, useLayoutEffect } from "react";
33
import { toast } from "sonner";
44
import { ButtonNavSite } from "@/components/custom/button-nav-site";
55
import { Alert, AlertDescription } from "@/components/ui/alert";
@@ -58,10 +58,6 @@ const InfoTab = () => {
5858
loadData();
5959
}, [getData]);
6060

61-
useEffect(() => {
62-
console.info("[index.tsx:56] ", siteCurrURL);
63-
}, [siteCurrURL]);
64-
6561
return (
6662
<section>
6763
<Alert className='m-0 border-none p-0'>

entrypoints/popup/PointTab/form-semester-dialog.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,11 @@ type Props = {
1515
open: boolean;
1616
onOpenChange: (open: boolean) => void;
1717
onSubmit: (semesterName: string) => void;
18-
initialValue?: string;
18+
initialValue: string;
1919
mode?: "add" | "edit";
2020
};
2121

22-
export const FormSemesterDialog = ({
23-
open,
24-
onOpenChange,
25-
onSubmit,
26-
initialValue = "Học kỳ mới",
27-
mode = "add"
28-
}: Props) => {
22+
export const FormSemesterDialog = ({ open, onOpenChange, onSubmit, initialValue, mode = "add" }: Props) => {
2923
const [semesterName, setSemesterName] = useState(initialValue);
3024

3125
useEffect(() => {
@@ -35,7 +29,11 @@ export const FormSemesterDialog = ({
3529
}, [open, initialValue]);
3630

3731
const handleSubmit = () => {
38-
onSubmit(semesterName);
32+
const trimmedName = semesterName.trim();
33+
if (!trimmedName) {
34+
return;
35+
}
36+
onSubmit(trimmedName);
3937
setSemesterName("Học kỳ mới");
4038
};
4139

entrypoints/popup/PointTab/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";
2424
import { Input } from "@/components/ui/input";
2525
import { Label } from "@/components/ui/label";
26+
import { Separator } from "@/components/ui/separator";
2627
import { _GET_POINT_DATA } from "@/constants/chrome";
2728
import { _DEFAULT_SITE_URL_MAPPING } from "@/constants/default";
2829
import { _DEFAULT_SCORE_SUMMARY } from "@/entrypoints/popup/PointTab/default";
@@ -307,7 +308,9 @@ const PointTab = () => {
307308
</div>
308309
</div>
309310

310-
<div className='space-y-3 px-4 pb-4'>
311+
<Separator className='mx-auto mb-4 max-w-[95%]' />
312+
313+
<div className='space-y-4 px-4 pb-4'>
311314
<div className='flex items-center gap-2'>
312315
<Input
313316
className='flex-1'
@@ -327,7 +330,8 @@ const PointTab = () => {
327330
Chỉ GPA
328331
</Label>
329332
</div>
330-
333+
</div>
334+
<div className='flex justify-end'>
331335
<Button onClick={() => setSemesterDialog({ open: true, mode: "add" })} size='sm' variant='outline'>
332336
<PlusIcon className='mr-2 h-4 w-4' />
333337
Thêm học kỳ
@@ -350,8 +354,8 @@ const PointTab = () => {
350354
<FormSemesterDialog
351355
initialValue={
352356
semesterDialog.mode === "edit" && semesterDialog.semesterIdx !== undefined
353-
? scores[semesterDialog.semesterIdx]?.title
354-
: undefined
357+
? scores[semesterDialog.semesterIdx]?.title || ""
358+
: "Học kỳ mới"
355359
}
356360
mode={semesterDialog.mode}
357361
onOpenChange={(open) => setSemesterDialog({ ...semesterDialog, open })}

0 commit comments

Comments
 (0)