Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Katsukiniwa committed Feb 29, 2024
1 parent 29be256 commit 9e8982d
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 2 deletions.
33 changes: 33 additions & 0 deletions admin/src/app/dashboard/@questions/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { getQuestionsByCategoryId } from "@/lib/data";
import { Table, Heading } from "@radix-ui/themes";
import Link from "next/link";

export default async function Page({ params }: { params: { id: string } }) {
const questions = await getQuestionsByCategoryId(Number(params.id));

return (
<div className="bg-sky-200 p-4 rounded-xl">
<Heading>Questions</Heading>
<Link href="/dashboard">back</Link>
<Table.Root>
<Table.Header>
<Table.Row>
<Table.ColumnHeaderCell>id</Table.ColumnHeaderCell>
<Table.ColumnHeaderCell>title</Table.ColumnHeaderCell>
<Table.ColumnHeaderCell>content</Table.ColumnHeaderCell>
</Table.Row>
</Table.Header>

<Table.Body>
{questions.map((question) => (
<Table.Row key={question.id}>
<Table.RowHeaderCell>{question.id}</Table.RowHeaderCell>
<Table.Cell>{question.title}</Table.Cell>
<Table.Cell>{question.content}</Table.Cell>
</Table.Row>
))}
</Table.Body>
</Table.Root>
</div>
);
}
33 changes: 33 additions & 0 deletions admin/src/app/dashboard/@questions/draft/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { getQuestionsByCategoryId } from "@/lib/data";
import { Table, Heading } from "@radix-ui/themes";
import Link from "next/link";

export default async function Page() {
const questions = await getQuestionsByCategoryId(1);

return (
<div className="bg-sky-200 p-4 rounded-xl">
<Heading>Questions</Heading>
<Link href="/dashboard">back</Link>
<Table.Root>
<Table.Header>
<Table.Row>
<Table.ColumnHeaderCell>id</Table.ColumnHeaderCell>
<Table.ColumnHeaderCell>title</Table.ColumnHeaderCell>
<Table.ColumnHeaderCell>content</Table.ColumnHeaderCell>
</Table.Row>
</Table.Header>

<Table.Body>
{questions.map((question) => (
<Table.Row key={question.id}>
<Table.RowHeaderCell>{question.id}</Table.RowHeaderCell>
<Table.Cell>{question.title}</Table.Cell>
<Table.Cell>{question.content}</Table.Cell>
</Table.Row>
))}
</Table.Body>
</Table.Root>
</div>
);
}
8 changes: 7 additions & 1 deletion admin/src/app/dashboard/@questions/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { getQuestions } from "@/lib/data";
import { Table, Heading } from "@radix-ui/themes";
import Link from "next/link";

export default async function Page() {
const questions = await getQuestions();

return (
<div className="bg-sky-200 p-4 rounded-xl">
<Heading>Questions</Heading>
<Link href="/dashboard/draft" className="my-4">
Draft
</Link>
<Table.Root>
<Table.Header>
<Table.Row>
Expand All @@ -19,7 +23,9 @@ export default async function Page() {
<Table.Body>
{questions.map((question) => (
<Table.Row key={question.id}>
<Table.RowHeaderCell>{question.id}</Table.RowHeaderCell>
<Table.RowHeaderCell>
<Link href={`/dashboard/${question.id}`}>{question.id}</Link>
</Table.RowHeaderCell>
<Table.Cell>{question.title}</Table.Cell>
<Table.Cell>{question.content}</Table.Cell>
</Table.Row>
Expand Down
1 change: 1 addition & 0 deletions backend/app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class UsersController < ApplicationController
# GET /users
def index
@users = User.all
pp @users.count

render json: @users
end
Expand Down
2 changes: 1 addition & 1 deletion backend/app/serializers/user_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# index_users_on_email (email) UNIQUE
#
class UserSerializer < ActiveModel::Serializer
attributes :id, :name, :icon, :email
attributes :id, :name, :email
end

0 comments on commit 9e8982d

Please sign in to comment.