Skip to content

Commit

Permalink
fix: prreview
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsdn0 committed Mar 27, 2024
1 parent 6eac878 commit 73c4905
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
5 changes: 0 additions & 5 deletions packages/api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ model Agenda {
title String
resolution String
content String
// type AgendaType
isNamed Boolean @default(false)
isPublic Boolean @default(true)
startAt DateTime? @map("start_at")
Expand All @@ -27,10 +26,6 @@ model Agenda {
@@map("agenda")
}

// type AgendaType {
// named Boolean @default(false)
// private Boolean @default(false)
// }

model User {
id Int @id @default(autoincrement())
Expand Down
2 changes: 2 additions & 0 deletions packages/api/src/service/admin.agenda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ export const updateAgenda = async (agendaUpdate: schema.AdminAgendaUpdate) => {
data: agendaUpdate.choices.map(it => ({ name: it })),
},
},
isNamed: agendaUpdate.type.named,
isPublic: agendaUpdate.type.public,
voters: {
createMany: {
data: agendaUpdate.voters.total.map(it => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/interface/src/admin/agenda/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { User } from "@/user";
* AdminAgendaStatus
* some description about admin agenda status type goes here
*/
export const AdminAgendaStatus = z.enum([...AgendaStatus.options]);
export const AdminAgendaStatus = z.enum(AgendaStatus.options);
export type AdminAgendaStatus = z.infer<typeof AdminAgendaStatus>;

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/molecules/OptionVoteResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const OptionVoteResult: React.FC<Props> = ({
{name}
</Text>
<Text color={userChoice ? "blue500" : "gray500"} variant="option1">
{ispublic ? count : ""}
{ispublic && count}
</Text>
</Box>
</Background>
Expand Down
12 changes: 7 additions & 5 deletions packages/web/src/components/organisms/EditAgendaModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ export const EditAgendaModal: React.FC = () => {

const [title, setTitle] = useState(targetAgenda?.title || "");
const [content, setContent] = useState(targetAgenda?.content || "");
const [isnamed, setIsnamed] = useState(false);
const [ispublic, setIspublic] = useState(true);
const [isNamed, setIsnamed] = useState(targetAgenda?.type.named || Boolean);
const [isPublic, setIspublic] = useState(
targetAgenda?.type.public || Boolean,
);
const [resolution, setResolution] = useState(targetAgenda?.resolution || "");
const [template, setTemplate] = useState(0);
const [choices, setChoices] = useState(
Expand Down Expand Up @@ -127,7 +129,7 @@ export const EditAgendaModal: React.FC = () => {
title,
content,
resolution,
type: targetAgenda?.type || { named: false, public: true },
type: { named: isNamed, public: isPublic },
voters: {
total: voters,
},
Expand Down Expand Up @@ -213,8 +215,8 @@ export const EditAgendaModal: React.FC = () => {
<AdminAgendaTagsSelect
switchPublic={onChangeIspublic}
switchNamed={onChangeIsnamed}
ispublic={ispublic}
isnamed={isnamed}
ispublic={isPublic}
isnamed={isNamed}
/>
<Box dir="row" w="fill" gap={10} justify="space-between">
<Link
Expand Down

0 comments on commit 73c4905

Please sign in to comment.