-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ドキュメント一覧ページを作成する #38
base: main
Are you sure you want to change the base?
ドキュメント一覧ページを作成する #38
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/app/docs/page.tsx
Outdated
import { useState, useEffect } from "react"; | ||
import supabase from "../../lib/supabase"; | ||
|
||
interface Doc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DBにあるテーブルの型はsupabaseの機能で生成したものを使ってください。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
型を supabase の機能で生成したものに変更しました🖊
src/app/docs/page.tsx
Outdated
const [totalPages, setTotalPages] = useState(0); | ||
const [loading, setLoading] = useState(true); | ||
|
||
const fetchDocs = async (page: number) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
テストしやすいようにページにはコンポーネントを置くだけの感じでお願いします〜。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/page.tsx にコンポネントを置くだけに変更しました🖊
cbcf4f8
to
c2d8a05
Compare
8be2d36
to
f33ed8c
Compare
src/app/docs/layout.tsx
Outdated
@@ -0,0 +1,9 @@ | |||
import SingleLayout from "@/components/layouts/SingleLayout"; | |||
|
|||
export default function DashboardLayout({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export default function DashboardLayout({ | |
export default function DocsLayout({ |
の方がいいかも?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DocsLayout に修正しました🖊
<li> | ||
<Link href="/dashboard">ダッシュボード</Link> | ||
</li> | ||
{links.map((link, index) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/components/DocList.tsx
Outdated
import supabase from "../lib/supabase"; | ||
import Pagination from "./Pagination"; | ||
|
||
interface Doc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これって自分で手書き定義しているからsupabaseの機能で生成した型を使っていることにならないかな〜と思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type Doc = Tables<"docs">;
に変更しました🖊
https://supabase.com/docs/guides/api/rest/generating-types#type-shorthands
updated_at TIMESTAMP DEFAULT NOW(), | ||
user_id INT NOT NULL, | ||
last_updated_user_id INT NOT NULL | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最終行に改行を挿入しました🖊
またエディタの設定で最後に改行されるようにしました⚙
@komagata さん、 |
Map を使って後から links にアイテムを追加しやすいようにする
last_updated_user_id を not null にする npx supabase db reset 後、 Studio でデータを確認 auth 実装後のコンフリクトを解消。 docs テーブルにデータを挿入する `supabase/seed.sql`
npx supabase gen types typescript --local > database.types.ts
docs/page.tsx にコンポネントのみ設置する
ec03455
to
24dbfe9
Compare
これに対するcomponent test, e2e testの作成をお願いします。 |
Issue
1回目の提出
概要
Docs
ページを作成Docs
ページにリストとページャーを設置変更確認方法
feature/create-docs-list
をローカルに取り込むnpm run dev
でローカル環境を立ち上げる変更前
変更後
top page
docs
概要
Docs
ページを作成Docs
ページにリストとページャーを設置useDocs
hook の作成itemsPerPage
で表示するドキュメント数を設定できるようにする変更確認方法
feature/create-docs-list
をローカルに取り込むnpm run dev
でローカル環境を立ち上げる変更前
変更後
top page
docs