-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix webinar form and webinar questions page
- Loading branch information
1 parent
3fb9f41
commit d5d6b81
Showing
8 changed files
with
217 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"nextjs-website": patch | ||
--- | ||
|
||
Fix webinar form and webinar questions page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
apps/nextjs-website/src/components/organisms/WebinarQuestionsTable/WebinarQuestionsTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { | ||
Paper, | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableContainer, | ||
TableHead, | ||
TableRow, | ||
} from '@mui/material'; | ||
import WebinarQuestionRow from '@/components/molecules/WebinarQuestion/WebinarQuestionRow'; | ||
import { updateWebinarQuestion } from '@/lib/webinarApi'; | ||
import { useTranslations } from 'next-intl'; | ||
import { WebinarQuestion } from '@/lib/webinars/webinarQuestions'; | ||
|
||
type WebinarQuestionsTableProps = { | ||
userName: string; | ||
questions: WebinarQuestion[]; | ||
title: string; | ||
}; | ||
|
||
const WebinarQuestionsTable = ({ | ||
userName, | ||
questions, | ||
title, | ||
}: WebinarQuestionsTableProps) => { | ||
const t = useTranslations('webinar.questionList'); | ||
|
||
return ( | ||
<TableContainer component={Paper} sx={{ marginY: 2 }}> | ||
<Table aria-label='simple table'> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>{t(`title.${title}`)}</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{questions.map((question) => ( | ||
<WebinarQuestionRow | ||
key={question.id.createdAt.toISOString()} | ||
question={question} | ||
userName={userName} | ||
onHide={async (hide) => | ||
await updateWebinarQuestion({ | ||
id: question.id, | ||
updates: { | ||
hiddenBy: hide | ||
? { operation: 'update', value: userName } | ||
: { operation: 'remove' }, | ||
}, | ||
}) | ||
} | ||
onHighlight={async (highlight) => | ||
await updateWebinarQuestion({ | ||
id: question.id, | ||
updates: { | ||
highlightedBy: highlight | ||
? { operation: 'update', value: userName } | ||
: { operation: 'remove' }, | ||
}, | ||
}) | ||
} | ||
/> | ||
))} | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
); | ||
}; | ||
|
||
export default WebinarQuestionsTable; |
Oops, something went wrong.