Skip to content
Merged
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
6 changes: 5 additions & 1 deletion app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export default async function PageDashboard() {
}))

return (
<AppShell user={user ?? undefined} initialSidebarOpen={initialSidebarOpen}>
<AppShell
title="ダッシュボード"
user={user ?? undefined}
initialSidebarOpen={initialSidebarOpen}
>
<DashboardPage
histories={histories}
discordLinked={!!user?.discordUserId}
Expand Down
1 change: 1 addition & 0 deletions app/medication/drugs/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default async function PageDrugEdit({

return (
<AppShell
title={`${drug.name ?? ''} - 薬を編集`}
user={user ?? undefined}
initialSidebarOpen={initialSidebarOpen}
breadcrumbs={[
Expand Down
1 change: 1 addition & 0 deletions app/medication/drugs/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default async function PageDrugDetail({

return (
<AppShell
title={`${drug.name ?? ''} - 薬詳細`}
user={user ?? undefined}
initialSidebarOpen={initialSidebarOpen}
breadcrumbs={[
Expand Down
6 changes: 5 additions & 1 deletion app/medication/drugs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export default async function PageDrugs({
}))

return (
<AppShell user={user ?? undefined} initialSidebarOpen={initialSidebarOpen}>
<AppShell
title="薬一覧"
user={user ?? undefined}
initialSidebarOpen={initialSidebarOpen}
>
<DrugListPage
items={items}
currentPage={data?.currentPage ?? 1}
Expand Down
1 change: 1 addition & 0 deletions app/medication/history/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default async function PageMedicationHistoryEdit({

return (
<AppShell
title={`${history.drugName ?? ''} - 服薬履歴を編集`}
user={user ?? undefined}
initialSidebarOpen={initialSidebarOpen}
breadcrumbs={[
Expand Down
1 change: 1 addition & 0 deletions app/medication/history/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default async function PageMedicationHistoryDetail({

return (
<AppShell
title={`${history.drugName ?? ''} - 服薬履歴詳細`}
user={user ?? undefined}
initialSidebarOpen={initialSidebarOpen}
breadcrumbs={[
Expand Down
6 changes: 5 additions & 1 deletion app/medication/history/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export default async function PageMedicationHistory({
}))

return (
<AppShell user={user ?? undefined} initialSidebarOpen={initialSidebarOpen}>
<AppShell
title="服薬履歴"
user={user ?? undefined}
initialSidebarOpen={initialSidebarOpen}
>
<MedicationHistoryPage
items={items}
currentPage={data?.currentPage ?? 1}
Expand Down
6 changes: 5 additions & 1 deletion app/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export default async function PageSettings() {
const initialSidebarOpen = await getInitialSidebarOpen()

return (
<AppShell user={user ?? undefined} initialSidebarOpen={initialSidebarOpen}>
<AppShell
title="設定"
user={user ?? undefined}
initialSidebarOpen={initialSidebarOpen}
>
<SettingsPage userName={user?.name ?? ''} />
</AppShell>
)
Expand Down
15 changes: 6 additions & 9 deletions components/layout/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,13 @@ const NAV_EXTRA: NavItem[] = [
{ text: '設定', href: '/settings', icon: Settings },
]

const ALL_NAV_ITEMS = [...NAV_GROUPS.flatMap((g) => g.items), ...NAV_EXTRA]

const SIDEBAR_COLLAPSED_WIDTH = 56

interface AppShellProps {
children: React.ReactNode
title?: string
user?: {
name: string
iconUrl: string | null
Expand All @@ -106,6 +109,7 @@ interface AppShellProps {

export default function AppShell({
children,
title,
user,
breadcrumbs,
initialSidebarOpen = true,
Expand Down Expand Up @@ -136,8 +140,6 @@ export default function AppShell({
[router],
)

const allNavItems = [...NAV_GROUPS.flatMap((g) => g.items), ...NAV_EXTRA]

const sideNavContent = (
<nav className="flex flex-col gap-1 py-2">
{NAV_GROUPS.map((group) => (
Expand Down Expand Up @@ -237,7 +239,7 @@ export default function AppShell({
</Button>
</div>
<nav className="flex flex-1 flex-col items-center gap-1 py-2">
{allNavItems.map((item) => (
{ALL_NAV_ITEMS.map((item) => (
<button
type="button"
key={item.href}
Expand Down Expand Up @@ -303,12 +305,7 @@ export default function AppShell({
<Menu className="size-4" />
</Button>
)}
<Link
href="/dashboard"
className="text-base font-bold hover:opacity-80"
>
Grace
</Link>
<h1 className="text-base font-semibold">{title ?? 'Grace'}</h1>
<div className="flex-1" />
<div className="flex items-center gap-1">
<ThemeToggle />
Expand Down
5 changes: 1 addition & 4 deletions components/page-component/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ const MOCK_HISTORIES: MedicationHistory[] = Array.from(
function MockDashboardContent() {
return (
<div className="flex flex-col gap-5">
<h1 className="text-2xl font-bold">ダッシュボード</h1>
<Card>
<CardHeader>
<CardTitle>服薬分析</CardTitle>
Expand Down Expand Up @@ -410,7 +409,6 @@ export default function DashboardPage({
if (discordLinked === false) {
return (
<div className="flex flex-col gap-5">
<h1 className="text-2xl font-bold">ダッシュボード</h1>
<DiscordLinkPrompt>
<MockDashboardContent />
</DiscordLinkPrompt>
Expand All @@ -420,8 +418,7 @@ export default function DashboardPage({

return (
<div className="flex flex-col gap-5">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold">ダッシュボード</h1>
<div className="flex items-center justify-end">
<PeriodSelect value={period} onChange={setPeriod} />
</div>

Expand Down
3 changes: 1 addition & 2 deletions components/page-component/DrugDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export default function DrugDetailPage({ drug }: DrugDetailPageProps) {

return (
<div className="flex flex-col gap-5">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold">{drug.name || '薬詳細'}</h1>
<div className="flex items-center justify-end">
<Button
variant="outline"
onClick={() => router.push(`/medication/drugs/${drug.id}/edit`)}
Expand Down
2 changes: 0 additions & 2 deletions components/page-component/DrugEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export default function DrugEditPage({ drug }: DrugEditPageProps) {
handleSubmit()
}}
>
<h1 className="text-2xl font-bold">薬を編集</h1>

<Card>
<CardHeader>
<CardTitle>基本情報</CardTitle>
Expand Down
4 changes: 1 addition & 3 deletions components/page-component/DrugListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export default function DrugListPage({
if (discordLinked === false) {
return (
<div className="flex h-full flex-col gap-5">
<h1 className="text-2xl font-bold">薬一覧</h1>
<DiscordLinkPrompt>
<DrugListTable
items={MOCK_ITEMS}
Expand All @@ -103,8 +102,7 @@ export default function DrugListPage({

return (
<div className="flex h-full flex-col gap-5">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold">薬一覧</h1>
<div className="flex items-center justify-end">
<Button onClick={() => setModalVisible(true)}>薬を登録</Button>
</div>
<DrugListTable
Expand Down
3 changes: 1 addition & 2 deletions components/page-component/MedicationHistoryDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export default function MedicationHistoryDetailPage({

return (
<div className="flex flex-col gap-5">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold">服薬履歴詳細</h1>
<div className="flex items-center justify-end">
<div className="flex items-center gap-2">
<AlertDialog>
<AlertDialogTrigger asChild>
Expand Down
2 changes: 0 additions & 2 deletions components/page-component/MedicationHistoryEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export default function MedicationHistoryEditPage({
handleSubmit()
}}
>
<h1 className="text-2xl font-bold">服薬履歴を編集</h1>

<Card>
<CardHeader>
<CardTitle>基本情報</CardTitle>
Expand Down
10 changes: 4 additions & 6 deletions components/page-component/MedicationHistoryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export default function MedicationHistoryPage({
if (discordLinked === false) {
return (
<div className="flex h-full flex-col gap-5">
<h1 className="text-2xl font-bold">服薬履歴</h1>
<DiscordLinkPrompt>
<MedicationHistoryTable
items={MOCK_ITEMS}
Expand All @@ -118,12 +117,11 @@ export default function MedicationHistoryPage({

return (
<div className="flex h-full flex-col gap-5">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold">服薬履歴</h1>
{drugs.length > 0 && (
{drugs.length > 0 && (
<div className="flex items-center justify-end">
<Button onClick={() => setModalVisible(true)}>服薬を記録</Button>
)}
</div>
</div>
)}
<MedicationHistoryTable
items={items}
currentPage={currentPage}
Expand Down
2 changes: 0 additions & 2 deletions components/page-component/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export default function SettingsPage({ userName }: SettingsPageProps) {

return (
<div className="flex flex-col gap-5">
<h1 className="text-2xl font-bold">設定</h1>

<DisplaySettings
preference={preference}
onChangePreference={setPreference}
Expand Down
21 changes: 14 additions & 7 deletions stories/layout/AppShell.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const meta = {
},
args: {
user: sampleUser,
title: '薬一覧',
},
} satisfies Meta<typeof AppShell>

Expand All @@ -27,9 +28,10 @@ type Story = StoryObj<typeof meta>

export const Default: Story = {
args: {
title: 'ダッシュボード',
children: (
<div className="flex flex-col gap-5">
<h1 className="text-2xl font-bold">ダッシュボード</h1>
<p className="text-sm text-muted-foreground">コンテンツエリア</p>
</div>
),
},
Expand All @@ -44,9 +46,10 @@ export const DrugListActive: Story = {
},
},
args: {
title: '薬一覧',
children: (
<div className="flex flex-col gap-5">
<h1 className="text-2xl font-bold">薬一覧</h1>
<p className="text-sm text-muted-foreground">コンテンツエリア</p>
</div>
),
},
Expand All @@ -61,14 +64,15 @@ export const DrugDetailWithBreadcrumbs: Story = {
},
},
args: {
title: 'レボチロキシン - 薬詳細',
breadcrumbs: [
{ text: 'Grace', href: '/dashboard' },
{ text: '薬一覧', href: '/medication/drugs' },
{ text: 'レボチロキシン', href: '/medication/drugs/1' },
],
children: (
<div className="flex flex-col gap-5">
<h1 className="text-2xl font-bold">レボチロキシン</h1>
<p className="text-sm text-muted-foreground">コンテンツエリア</p>
</div>
),
},
Expand All @@ -83,9 +87,10 @@ export const MedicationHistoryActive: Story = {
},
},
args: {
title: '服薬履歴',
children: (
<div className="flex flex-col gap-5">
<h1 className="text-2xl font-bold">服薬履歴</h1>
<p className="text-sm text-muted-foreground">コンテンツエリア</p>
</div>
),
},
Expand All @@ -100,14 +105,15 @@ export const MedicationHistoryDetailWithBreadcrumbs: Story = {
},
},
args: {
title: 'レボチロキシン - 服薬履歴詳細',
breadcrumbs: [
{ text: 'Grace', href: '/dashboard' },
{ text: '服薬履歴', href: '/medication/history' },
{ text: '服薬履歴詳細', href: '/medication/history/1' },
{ text: 'レボチロキシン', href: '/medication/history/1' },
],
children: (
<div className="flex flex-col gap-5">
<h1 className="text-2xl font-bold">服薬履歴詳細</h1>
<p className="text-sm text-muted-foreground">コンテンツエリア</p>
</div>
),
},
Expand All @@ -122,9 +128,10 @@ export const SettingsActive: Story = {
},
},
args: {
title: '設定',
children: (
<div className="flex flex-col gap-5">
<h1 className="text-2xl font-bold">設定</h1>
<p className="text-sm text-muted-foreground">コンテンツエリア</p>
</div>
),
},
Expand Down
Loading