diff --git a/src/app/quiz/Search.js b/src/app/quiz/Search.js
deleted file mode 100644
index 4467bd6c..00000000
--- a/src/app/quiz/Search.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright 2024 OpenBuild
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use client';
-
-import { usePathname, useRouter, useSearchParams } from 'next/navigation';
-import { useDebouncedCallback } from 'use-debounce';
-
-import { SearchIcon } from '@/components/Icons';
-import Input from '@/components/Input';
-
-export function QuizSearch() {
- const searchParams = useSearchParams();
- const { replace } = useRouter();
- const pathname = usePathname();
-
- const handleSearch = useDebouncedCallback(term => {
- const params = new URLSearchParams(searchParams);
- params.set('page', '1');
- if (term) {
- params.set('query', term);
- } else {
- params.delete('query');
- }
- replace(`${pathname}?${params.toString()}`);
- }, 300);
-
- return (
-
- Who is able to participate in Quiz?
+ Who is able to participate in Quiz?
-
Anyone can participate in Quiz, and to claim the prize, users must connect their Github account first.
+
+ Anyone can participate in Quiz, and to claim the prize, users must connect their Github account first.
+
@@ -154,10 +164,12 @@ export default function Quiz() {
Can I take the Quiz if it has ended?
-
You can always take the Quiz whenever you want. However, the prize is available only when the quiz status is Ongoing.
+
+ You can always take the Quiz whenever you want. However, the prize is available only when the quiz
+ status is Ongoing.{' '}
+
-
diff --git a/src/domain/quiz/widgets/quiz-item/QuizItem.js b/src/domain/quiz/views/quiz-list-view/QuizItem.js
similarity index 96%
rename from src/domain/quiz/widgets/quiz-item/QuizItem.js
rename to src/domain/quiz/views/quiz-list-view/QuizItem.js
index 0d24eb41..e22ef384 100644
--- a/src/domain/quiz/widgets/quiz-item/QuizItem.js
+++ b/src/domain/quiz/views/quiz-list-view/QuizItem.js
@@ -41,10 +41,10 @@ function QuizItem({ data, children }) {
{data?.user_list?.slice(0, 10).map(i => (
diff --git a/src/app/quiz/List.js b/src/domain/quiz/views/quiz-list-view/QuizListView.js
similarity index 58%
rename from src/app/quiz/List.js
rename to src/domain/quiz/views/quiz-list-view/QuizListView.js
index e8b8aa0c..e5a7f79d 100644
--- a/src/app/quiz/List.js
+++ b/src/domain/quiz/views/quiz-list-view/QuizListView.js
@@ -14,12 +14,7 @@
* limitations under the License.
*/
-'use client';
-
-import Image from 'next/image';
-import Link from 'next/link';
import { useSearchParams, useRouter } from 'next/navigation';
-import TrophiesSvg from 'public/images/trophies.svg';
import { useState } from 'react';
import useSWR from 'swr';
import { useDebouncedCallback } from 'use-debounce';
@@ -29,62 +24,14 @@ import Input from '@/components/Input';
import { OPagination } from '@/components/Pagination';
import { ReactSelect } from '@/components/Select/ReactSelect';
import useMounted from '@/hooks/useMounted';
-import { markdownToPlainText } from '@/utils/markdown';
import { fetcher } from '@/utils/request';
-import { fetchTeamList } from '#/domain/quiz/repository';
-import { useMediaUrl } from '#/state/application/hooks';
-
-function List({ data }) {
- const mediaUrl = useMediaUrl();
-
- return (
-
-
-
- );
-}
+import { fetchTeamList } from '../../repository';
+import QuizItem from './QuizItem';
const pageSize = 10;
-export function QuizList() {
+export default function QuizListView() {
const searchParams = useSearchParams();
const router = useRouter();
const [query, setQuery] = useState(searchParams?.get('search') || '');
@@ -93,7 +40,10 @@ export function QuizList() {
const [pageOffset, setPageOffset] = useState(0);
const [selectedTeam, setSelectedTeam] = useState(null);
const [teamOptions, setTeamOptions] = useState([]);
- const { data, isLoading } = useSWR(`ts/v1/quiz?skip=${pageOffset}&take=${pageSize}&search=${query}&team_uid=${teamUid}`, fetcher);
+ const { data, isLoading } = useSWR(
+ `ts/v1/quiz?skip=${pageOffset}&take=${pageSize}&search=${query}&team_uid=${teamUid}`,
+ fetcher,
+ );
const updateUrlParams = (search, teamUid) => {
const params = new URLSearchParams();
@@ -173,7 +123,7 @@ export function QuizList() {
) : (
<>
{data?.list.map((i, k) => (
-
+
))}
>
diff --git a/src/domain/quiz/widgets/quiz-item/index.js b/src/domain/quiz/views/quiz-list-view/index.js
similarity index 93%
rename from src/domain/quiz/widgets/quiz-item/index.js
rename to src/domain/quiz/views/quiz-list-view/index.js
index bcd26808..1fcc1e37 100644
--- a/src/domain/quiz/widgets/quiz-item/index.js
+++ b/src/domain/quiz/views/quiz-list-view/index.js
@@ -14,4 +14,4 @@
* limitations under the License.
*/
-export { default } from './QuizItem';
+export { default } from './QuizListView';
diff --git a/src/domain/quiz/widgets/quiz-item/style.module.scss b/src/domain/quiz/views/quiz-list-view/style.module.scss
similarity index 100%
rename from src/domain/quiz/widgets/quiz-item/style.module.scss
rename to src/domain/quiz/views/quiz-list-view/style.module.scss
diff --git a/src/app/quiz/[id]/RankList.js b/src/domain/quiz/views/rank-list-view/RankListView.js
similarity index 97%
rename from src/app/quiz/[id]/RankList.js
rename to src/domain/quiz/views/rank-list-view/RankListView.js
index 1861a123..072747b2 100644
--- a/src/app/quiz/[id]/RankList.js
+++ b/src/domain/quiz/views/rank-list-view/RankListView.js
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-'use client';
-
import Image from 'next/image';
import Rank1Icon from 'public/images/svg/rank-1.svg';
import Rank2Icon from 'public/images/svg/rank-2.svg';
@@ -23,7 +21,7 @@ import Rank3Icon from 'public/images/svg/rank-3.svg';
import { useMediaUrl } from '#/state/application/hooks';
-export default function RankList({ rank, list }) {
+export default function RankListView({ rank, list }) {
const mediaUrl = useMediaUrl();
return (
diff --git a/src/domain/quiz/views/rank-list-view/index.js b/src/domain/quiz/views/rank-list-view/index.js
new file mode 100644
index 00000000..1b3d5f97
--- /dev/null
+++ b/src/domain/quiz/views/rank-list-view/index.js
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2024 OpenBuild
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export { default } from './RankListView';
diff --git a/src/domain/quiz/views/record-list-view/RecordListView.js b/src/domain/quiz/views/record-list-view/RecordListView.js
new file mode 100644
index 00000000..71a2eb3a
--- /dev/null
+++ b/src/domain/quiz/views/record-list-view/RecordListView.js
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2024 OpenBuild
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Image from 'next/image';
+import Link from 'next/link';
+
+import { formatTime, fromUtcOffset, formatTimeMeridiem } from '@/utils/date';
+
+function RecordListView({
+ data = [],
+ mediaUrl,
+}) {
+ return (
+
+ );
+}
+
+export default RecordListView;
diff --git a/src/domain/quiz/views/record-list-view/index.js b/src/domain/quiz/views/record-list-view/index.js
new file mode 100644
index 00000000..ccda1a42
--- /dev/null
+++ b/src/domain/quiz/views/record-list-view/index.js
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2024 OpenBuild
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export { default } from './RecordListView';
diff --git a/src/domain/quiz/widgets/quiz-list-item/QuizListItem.js b/src/domain/quiz/widgets/quiz-list-item/QuizListItem.js
new file mode 100644
index 00000000..cc9be2ff
--- /dev/null
+++ b/src/domain/quiz/widgets/quiz-list-item/QuizListItem.js
@@ -0,0 +1,84 @@
+/**
+ * Copyright 2024 OpenBuild
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Image from 'next/image';
+import Link from 'next/link';
+import TrophiesSvg from 'public/images/trophies.svg';
+
+import { markdownToPlainText } from '#/shared/utils/markdown';
+import { useMediaUrl } from '#/state/application/hooks';
+export default function QuizListItem({ data }) {
+ const mediaUrl = useMediaUrl();
+
+ return (
+
+
+
+ );
+}
diff --git a/src/domain/quiz/widgets/quiz-list-item/index.js b/src/domain/quiz/widgets/quiz-list-item/index.js
new file mode 100644
index 00000000..29e40f98
--- /dev/null
+++ b/src/domain/quiz/widgets/quiz-list-item/index.js
@@ -0,0 +1,17 @@
+/**
+ * Copyright 2024 OpenBuild
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export { default } from './QuizListItem';