diff --git a/src/app/_components/feedArticleList/feedArticleList.tsx b/src/app/_components/feedArticleList/feedArticleList.tsx deleted file mode 100644 index 437d40f..0000000 --- a/src/app/_components/feedArticleList/feedArticleList.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Pagination, PaginationItem } from "@/modules/common/components/pagination"; -import { calcTotalPageNumber } from "@/modules/common/functions/pagination"; -import { ArticleCard } from "@/modules/features/article/components/articleCard"; -import { fetchFeedArticles } from "@/modules/features/article/fetch/fetchArticleList"; - -const Pages = ({ totalPages, currentPage }: { totalPages: number; currentPage: number }) => ( - - {[...Array(totalPages)].map((_, index) => { - const page = index + 1; - const href = `/?tab=global&page=${page}`; - return ( - - {page} - - ); - })} - -); - -export const FeedArticleList = async ({ currentPage }: { currentPage: number }) => { - const { articles, articlesCount } = await fetchFeedArticles(currentPage); - const totalPages = calcTotalPageNumber(articlesCount, 10); - - return articles.length < 1 ? ( -

No articles found.

- ) : ( - <> - {articles.map((article, index) => ( - - ))} - {1 < totalPages && } - - ); -}; diff --git a/src/app/_components/feedArticleList/index.ts b/src/app/_components/feedArticleList/index.ts deleted file mode 100644 index 030dad4..0000000 --- a/src/app/_components/feedArticleList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./feedArticleList"; diff --git a/src/app/_components/globalArticleList/globalArticleList.tsx b/src/app/_components/globalArticleList/globalArticleList.tsx deleted file mode 100644 index cb79c31..0000000 --- a/src/app/_components/globalArticleList/globalArticleList.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Pagination, PaginationItem } from "@/modules/common/components/pagination"; -import { calcTotalPageNumber } from "@/modules/common/functions/pagination"; -import { ArticleCard } from "@/modules/features/article/components/articleCard"; -import { fetchGlobalArticles } from "@/modules/features/article/fetch/fetchArticleList"; - -const Pages = ({ totalPages, currentPage }: { totalPages: number; currentPage: number }) => ( - - {[...Array(totalPages)].map((_, index) => { - const page = index + 1; - const href = `/?tab=global&page=${page}`; - return ( - - {page} - - ); - })} - -); - -export const GlobalArticleList = async ({ currentPage }: { currentPage: number }) => { - const { articles, articlesCount } = await fetchGlobalArticles(currentPage); - const totalPages = calcTotalPageNumber(articlesCount, 10); - - return articles.length < 1 ? ( -

No articles found.

- ) : ( - <> - {articles.map((article, index) => ( - - ))} - {1 < totalPages && } - - ); -}; diff --git a/src/app/_components/globalArticleList/index.ts b/src/app/_components/globalArticleList/index.ts deleted file mode 100644 index 599df6a..0000000 --- a/src/app/_components/globalArticleList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./globalArticleList"; diff --git a/src/app/_components/layoutElements/index.ts b/src/app/_components/layoutElements/index.ts deleted file mode 100644 index a2fcb59..0000000 --- a/src/app/_components/layoutElements/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./logoHeader"; -export * from "./logoSmall"; \ No newline at end of file diff --git a/src/app/_components/layoutElements/logoHeader.tsx b/src/app/_components/layoutElements/logoHeader.tsx deleted file mode 100644 index 1595f4e..0000000 --- a/src/app/_components/layoutElements/logoHeader.tsx +++ /dev/null @@ -1,44 +0,0 @@ -const LogoHeader: React.FC = () => { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -}; - -export default LogoHeader; diff --git a/src/app/_components/layoutElements/logoSmall.tsx b/src/app/_components/layoutElements/logoSmall.tsx deleted file mode 100644 index f353085..0000000 --- a/src/app/_components/layoutElements/logoSmall.tsx +++ /dev/null @@ -1,44 +0,0 @@ -const LogoSmall: React.FC = () => { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -}; - -export default LogoSmall; diff --git a/src/app/_components/tagArticleList/index.ts b/src/app/_components/tagArticleList/index.ts deleted file mode 100644 index 571cbff..0000000 --- a/src/app/_components/tagArticleList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./tagArticleList"; diff --git a/src/app/_components/tagArticleList/tagArticleList.tsx b/src/app/_components/tagArticleList/tagArticleList.tsx deleted file mode 100644 index 6c91df8..0000000 --- a/src/app/_components/tagArticleList/tagArticleList.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Pagination, PaginationItem } from "@/modules/common/components/pagination"; -import { calcTotalPageNumber } from "@/modules/common/functions/pagination"; -import { ArticleCard } from "@/modules/features/article/components/articleCard"; -import { fetchArticlesByTag } from "@/modules/features/article/fetch/fetchArticleList"; - -const Pages = ({ totalPages, currentPage }: { totalPages: number; currentPage: number }) => ( - - {[...Array(totalPages)].map((_, index) => { - const page = index + 1; - const href = `/?tab=global&page=${page}`; - return ( - - {page} - - ); - })} - -); - -export const TagArticleList = async ({ tag, currentPage }: { tag: string; currentPage: number }) => { - const { articles, articlesCount } = await fetchArticlesByTag(tag, currentPage); - const totalPages = calcTotalPageNumber(articlesCount, 10); - - return articles.length < 1 ? ( -

No articles found.

- ) : ( - <> - {articles.map((article, index) => ( - - ))} - {1 < totalPages && } - - ); -}; diff --git a/src/app/_components/tagList/container.tsx b/src/app/_components/tagList/container.tsx deleted file mode 100644 index 620a37b..0000000 --- a/src/app/_components/tagList/container.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { fetchTagsList } from "@/modules/features/article/fetch/fetchTagsList"; -import { TagList as TagListPresentation } from "./presentation"; - -export const TagList = async () => { - const tags = await fetchTagsList(); - return ; -}; diff --git a/src/app/_components/tagList/index.ts b/src/app/_components/tagList/index.ts deleted file mode 100644 index c5b5e8f..0000000 --- a/src/app/_components/tagList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./container"; diff --git a/src/app/_components/tagList/presentation.tsx b/src/app/_components/tagList/presentation.tsx deleted file mode 100644 index 152b78f..0000000 --- a/src/app/_components/tagList/presentation.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Tag } from "@/modules/features/article/components/tag"; - -type Props = { tags: string[] }; - -export const TagList = ({ tags }: Props) => ( -
-

Popular Tags

-
- {tags.map((tag, index) => ( - - {tag} - - ))} -
-
-); diff --git a/src/app/_components/timeClock/index.ts b/src/app/_components/timeClock/index.ts deleted file mode 100644 index 27bf14f..0000000 --- a/src/app/_components/timeClock/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./timeClock"; diff --git a/src/app/_components/timeClock/timeClock.tsx b/src/app/_components/timeClock/timeClock.tsx deleted file mode 100644 index c2ca8bd..0000000 --- a/src/app/_components/timeClock/timeClock.tsx +++ /dev/null @@ -1,184 +0,0 @@ -"use client"; - -import React, { useEffect } from "react"; - -const TimeClock: React.FC = () => { - useEffect(() => { - const numbers = [ - [1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1], // 0 - [1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1], // 1 - [1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1], // 2 - [1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1], // 3 - [1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1], // 4 - [1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1], // 5 - [1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1], // 6 - [1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0], // 7 - [1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1], // 8 - [1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1], // 9 - ]; - - const blocks: Array = []; - const digits = Array.from(document.querySelectorAll(".block")); - - for (let i = 0; i < 4; i++) { - blocks.push(digits.slice(i * 15, i * 15 + 15)); - } - - const setNum = (block: Array, num: number) => { - const n = numbers[num]; - for (let i = 0; i < block.length; i++) { - block[i].classList[n[i] === 1 ? "add" : "remove"]("active"); - } - }; - - const time = { - s: "", - m: "", - h: "", - p: 0, - }; - - // time loop - const animator = () => { - const d = new Date(); - let h = d.getHours().toString(), - m = d.getMinutes().toString(), - s = d.getSeconds().toString(); - - s = s.length === 1 ? "0" + s : s; - m = m.length === 1 ? "0" + m : m; - h = h.length === 1 ? "0" + h : h; - - if (s !== time.s) { - for (let i = 0; i < digits.length; i++) { - const d = digits[i]; - if (i === +s) { - d.classList.add("second"); - if (time.p !== null) digits[time.p].classList.remove("second"); - time.p = i; - time.s = s; - } - } - } - - if (m !== time.m) { - setNum(blocks[2], parseInt(Array.from(m)[0])); - setNum(blocks[3], parseInt(Array.from(m)[1])); - time.m = m; - } - - if (h !== time.h) { - setNum(blocks[0], parseInt(Array.from(h)[0])); - setNum(blocks[1], parseInt(Array.from(h)[1])); - time.h = h; - } - window.requestAnimationFrame(animator); - }; - - // init - window.requestAnimationFrame(animator); - - // toggle button - const d = new Date(); - const days = ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"]; - const months = [ - "Janvier", - "Février", - "Mars", - "Avril", - "Mai", - "Juin", - "Juillet", - "Août", - "Septembre", - "Octobre", - "Novembre", - "Décembre", - ]; - const lib_d = days[d.getDay()]; - const lib_m = months[d.getMonth()]; - const lib_n = d.getDate(); - const lib_y = d.getFullYear(); - document.getElementById("datelib")!.innerHTML = lib_d + " " + lib_n + " " + lib_m + " " + lib_y; - }, []); - - return ( - <> -
-
-
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - ); -}; - -export default TimeClock; diff --git a/src/app/_types/index.ts b/src/app/_types/index.ts deleted file mode 100644 index 7016380..0000000 --- a/src/app/_types/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { z } from "zod"; - -export const SearchParams = z.object({ - page: z.coerce.number().int().min(1).catch(1), - tab: z.enum(["yours", "global", "tag"]).default("global"), - tag: z.string().optional(), -}); - -export type SearchParams = z.infer; diff --git a/src/app/article/[slug]/_components/articleArea/articleArea.module.css b/src/app/article/[slug]/_components/articleArea/articleArea.module.css deleted file mode 100644 index 527f81c..0000000 --- a/src/app/article/[slug]/_components/articleArea/articleArea.module.css +++ /dev/null @@ -1,9 +0,0 @@ -.actions { - & * + * { - margin-left: 10px; - } -} - -.action-btn + .action-btn { - margin-left: 5px; -} diff --git a/src/app/article/[slug]/_components/articleArea/articleArea.tsx b/src/app/article/[slug]/_components/articleArea/articleArea.tsx deleted file mode 100644 index 4c07695..0000000 --- a/src/app/article/[slug]/_components/articleArea/articleArea.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { Container, Col, Row } from "react-bootstrap"; -import { Button } from "@/modules/common/components/button"; -import { DeleteArticleButton } from "@/modules/features/article/components/deleteArticleButton"; -import { FavoriteButton } from "@/modules/features/article/components/favoriteButton"; -import { Tag } from "@/modules/features/article/components/tag"; -import { fetchArticle } from "@/modules/features/article/fetch/fetchArticle"; -import { convertMarkdownToHtml } from "@/modules/features/article/functions"; -import { FollowButton } from "@/modules/features/profile/components/followButton"; -import { Article, User } from "@/utils/types/models"; -import Link from "next/link"; -import Image from "next/image"; -import { ReactNode } from "react"; -import styles from "./articleArea.module.css"; -import { showDeleteArticleButton, showEditArticleButton, showFollowButton } from "./functions"; -import { getSession } from "@/utils/auth/session"; -import { fetchCurrentUser } from "@/modules/features/auth/fetch/fetchCurrentUser"; - -const Actions = ({ article, currentUser }: { article: Article; currentUser?: User }) => { - const profile = article.author; - - return ( -
- {profile.image && } -
- - {profile.username} - - {article.createdAt.toDateString()} -
- {showFollowButton(profile.username, currentUser) && ( - - )} - - {showEditArticleButton(profile.username, currentUser) && ( - - )} - {showDeleteArticleButton(profile.username, currentUser) && ( - - )} -
- ); -}; - -export const ArticleArea = async ({ slug, children }: { slug: string; children: ReactNode }) => { - const article = await fetchArticle(slug); - const body = await convertMarkdownToHtml(article.body); - const currentUser = (await getSession()) ? await fetchCurrentUser() : undefined; - - return ( -
- -

{article.title}

- -
- - - -
-
    - {article.tagList.map((tag, index) => ( -
  • - - {tag} - -
  • - ))} -
- - -
-
- -
- {children} - -
- ); -}; diff --git a/src/app/article/[slug]/_components/articleArea/functions.ts b/src/app/article/[slug]/_components/articleArea/functions.ts deleted file mode 100644 index 4c39799..0000000 --- a/src/app/article/[slug]/_components/articleArea/functions.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { User } from "@/utils/types/models"; - -export const showFollowButton = (authorUsername: string, currentUser: User | undefined) => { - return authorUsername !== currentUser?.username; -}; - -export const showEditArticleButton = (authorUsername: string, currentUser: User | undefined) => { - return authorUsername === currentUser?.username; -}; - -export const showDeleteArticleButton = (authorUsername: string, currentUser: User | undefined) => { - return authorUsername === currentUser?.username; -}; diff --git a/src/app/article/[slug]/_components/articleArea/index.ts b/src/app/article/[slug]/_components/articleArea/index.ts deleted file mode 100644 index ebe58aa..0000000 --- a/src/app/article/[slug]/_components/articleArea/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./articleArea"; diff --git a/src/app/article/[slug]/_components/commentCard/action.ts b/src/app/article/[slug]/_components/commentCard/action.ts deleted file mode 100644 index 1aec53a..0000000 --- a/src/app/article/[slug]/_components/commentCard/action.ts +++ /dev/null @@ -1,30 +0,0 @@ -"use server"; - -import { createApiClient } from "@/utils/api/apiClient"; -import { getSession } from "@/utils/auth/session"; -import { revalidateTag } from "next/cache"; -import { redirect } from "next/navigation"; -import { Inputs } from "./types"; - -export const deleteCommentAction = async (_prevState: undefined, inputs: Inputs): Promise => { - if ((await getSession()) == null) { - redirect("/login"); - } - - const apiClient = createApiClient({ - path: "/articles/{slug}/comments/{id}", - method: "delete", - params: { - path: inputs, - }, - }); - - const response = await apiClient.sendRequest(); - - if (response.result === "success") { - revalidateTag(""); - return undefined; - } - - throw new Error("api error"); -}; diff --git a/src/app/article/[slug]/_components/commentCard/container.tsx b/src/app/article/[slug]/_components/commentCard/container.tsx deleted file mode 100644 index 5e6b400..0000000 --- a/src/app/article/[slug]/_components/commentCard/container.tsx +++ /dev/null @@ -1,36 +0,0 @@ -"use client"; - -import { Comment, User } from "@/utils/types/models"; -import { use, useActionState } from "react"; -import { deleteCommentAction as serverAction } from "./action"; -import { CommentCard as CommentCardPresentation } from "./presentation"; -import { showDeleteCommentButton } from "./functions"; - -type Props = { - slug: string; - comment: Comment; - currentUserPromise?: Promise; -}; - -export const CommentCard = ({ slug, comment, currentUserPromise }: Props) => { - const [_state, dispatch, isPending] = useActionState(serverAction, undefined); - - const action = () => { - if (!confirm("Delete comment?")) { - return; - } - dispatch({ slug, id: comment.id }); - }; - - return ( - - ); -}; diff --git a/src/app/article/[slug]/_components/commentCard/functions.ts b/src/app/article/[slug]/_components/commentCard/functions.ts deleted file mode 100644 index f128b35..0000000 --- a/src/app/article/[slug]/_components/commentCard/functions.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { User } from "@/utils/types/models"; - -export const showDeleteCommentButton = (commentAuthorUsername: string, currentUser?: User) => { - return commentAuthorUsername === currentUser?.username; -}; diff --git a/src/app/article/[slug]/_components/commentCard/index.ts b/src/app/article/[slug]/_components/commentCard/index.ts deleted file mode 100644 index c5b5e8f..0000000 --- a/src/app/article/[slug]/_components/commentCard/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./container"; diff --git a/src/app/article/[slug]/_components/commentCard/presentation.module.css b/src/app/article/[slug]/_components/commentCard/presentation.module.css deleted file mode 100644 index 5b1c050..0000000 --- a/src/app/article/[slug]/_components/commentCard/presentation.module.css +++ /dev/null @@ -1,13 +0,0 @@ -.form { - display: inline; - - & button { - background: none; - color: inherit; - border: none; - padding: 0; - font: inherit; - cursor: pointer; - outline: inherit; - } -} diff --git a/src/app/article/[slug]/_components/commentCard/presentation.tsx b/src/app/article/[slug]/_components/commentCard/presentation.tsx deleted file mode 100644 index 764e3f6..0000000 --- a/src/app/article/[slug]/_components/commentCard/presentation.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Button, Form } from "react-bootstrap"; -import Link from "next/link"; -import Image from "next/image"; -import { Comment } from "@/utils/types/models"; -import styles from "./presentation.module.css"; - -type Props = { - comment: Comment; - showDeleteCommentButton?: boolean; - deleteCommentAction?: () => void; - isPending?: boolean; -}; - -export const CommentCard = ({ comment, showDeleteCommentButton, deleteCommentAction }: Props) => { - return ( -
-
-

{comment.body}

-
-
- - {comment.author.image && } - -   - - {comment.author.username} - - {comment.createdAt.toDateString()} - {showDeleteCommentButton && ( -
- - - )} -
-
- ); -}; diff --git a/src/app/article/[slug]/_components/commentCard/types.ts b/src/app/article/[slug]/_components/commentCard/types.ts deleted file mode 100644 index 919dd86..0000000 --- a/src/app/article/[slug]/_components/commentCard/types.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type Inputs = { - slug: string; - id: string; -}; diff --git a/src/app/article/[slug]/_components/commentForm/action.ts b/src/app/article/[slug]/_components/commentForm/action.ts deleted file mode 100644 index b63369d..0000000 --- a/src/app/article/[slug]/_components/commentForm/action.ts +++ /dev/null @@ -1,57 +0,0 @@ -"use server"; - -import { createApiClient } from "@/utils/api/apiClient"; -import { getSession } from "@/utils/auth/session"; -import { SubmissionResult } from "@conform-to/react"; -import { parseWithZod } from "@conform-to/zod"; -import { revalidateTag } from "next/cache"; -import { redirect } from "next/navigation"; -import { inputsSchema } from "./types"; - -export const postCommentAction = async ( - _prevState: unknown, - formData: FormData, -): Promise> => { - if ((await getSession()) == null) { - redirect("/login"); - } - - const submission = parseWithZod(formData, { schema: inputsSchema }); - - if (submission.status !== "success") { - return submission.reply(); - } - - const { slug, body } = submission.value; - - const apiClient = createApiClient({ - path: "/articles/{slug}/comments", - method: "post", - params: { - path: { - slug, - }, - body: { - comment: { - body, - }, - }, - }, - }); - - const response = await apiClient.sendRequest(); - - if (response.result === "success") { - revalidateTag(""); - return submission.reply(); - } - - switch (response.statusCode) { - case 422: - return submission.reply({ - formErrors: Object.values(response.error.errors).flat(), - }); - default: - throw new Error("api error"); - } -}; diff --git a/src/app/article/[slug]/_components/commentForm/container.tsx b/src/app/article/[slug]/_components/commentForm/container.tsx deleted file mode 100644 index 60d5f2b..0000000 --- a/src/app/article/[slug]/_components/commentForm/container.tsx +++ /dev/null @@ -1,26 +0,0 @@ -"use client"; - -import { User } from "@/utils/types/models"; -import { use, useActionState } from "react"; -import { postCommentAction } from "./action"; -import { CommentForm as CommentFormPresentation } from "./presentation"; - -type Props = { - slug: string; - currentUserPromise?: Promise; -}; - -export const CommentForm = ({ slug, currentUserPromise }: Props) => { - const currentUser = currentUserPromise && use(currentUserPromise); - const [state, action, isPending] = useActionState(postCommentAction, undefined); - - return ( - - ); -}; diff --git a/src/app/article/[slug]/_components/commentForm/index.ts b/src/app/article/[slug]/_components/commentForm/index.ts deleted file mode 100644 index c5b5e8f..0000000 --- a/src/app/article/[slug]/_components/commentForm/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./container"; diff --git a/src/app/article/[slug]/_components/commentForm/presentation.tsx b/src/app/article/[slug]/_components/commentForm/presentation.tsx deleted file mode 100644 index 3a4b99e..0000000 --- a/src/app/article/[slug]/_components/commentForm/presentation.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { Button, Form } from "react-bootstrap"; -import Image from "next/image"; -import { ErrorMessage } from "@/modules/common/components/errorMessage"; -import { SubmissionResult, useForm } from "@conform-to/react"; -import { parseWithZod } from "@conform-to/zod"; -import { startTransition } from "react"; -import { inputsSchema } from "./types"; - -type Props = { - slug?: string; - authorImage?: string; - result?: SubmissionResult; - postCommentAction?: (formData: FormData) => void; - isPending?: boolean; -}; - -export const CommentForm = ({ slug, authorImage, result, postCommentAction, isPending }: Props) => { - const [form, fields] = useForm({ - defaultValue: { - slug, - }, - lastResult: result, - onValidate({ formData }) { - return parseWithZod(formData, { schema: inputsSchema }); - }, - // onSubmit is defined to avoid resetting form after successful submission - // see https://github.com/edmundhung/conform/discussions/606 - onSubmit(event, { formData }) { - event.preventDefault(); - startTransition(() => { - postCommentAction?.(formData); - }); - }, - shouldRevalidate: "onBlur", - }); - - const errors = Object.values(form.allErrors).flat(); - - return ( - <> -
- -
- - -
-
- {authorImage && } - -
- - - ); -}; diff --git a/src/app/article/[slug]/_components/commentForm/types.ts b/src/app/article/[slug]/_components/commentForm/types.ts deleted file mode 100644 index 2ea7e30..0000000 --- a/src/app/article/[slug]/_components/commentForm/types.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { z } from "zod"; - -export const inputsSchema = z.object({ - slug: z.string().max(200), - body: z.string().max(200), -}); - -export type Inputs = z.infer; diff --git a/src/app/article/[slug]/_components/commentList/commentList.tsx b/src/app/article/[slug]/_components/commentList/commentList.tsx deleted file mode 100644 index 722822b..0000000 --- a/src/app/article/[slug]/_components/commentList/commentList.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { fetchComments } from "@/modules/features/article/fetch/fetchComments"; -import { fetchCurrentUser } from "@/modules/features/auth/fetch/fetchCurrentUser"; -import { getSession } from "@/utils/auth/session"; -import { CommentCard } from "../commentCard"; - -type Props = { - slug: string; -}; - -export const CommentList = async ({ slug }: Props) => { - const comments = await fetchComments(slug); - const currentUserPromise = (await getSession()) ? fetchCurrentUser() : undefined; - - return ( - <> - {comments.map((comment, index) => ( - - ))} - - ); -}; diff --git a/src/app/article/[slug]/_components/commentList/index.ts b/src/app/article/[slug]/_components/commentList/index.ts deleted file mode 100644 index 5b60efa..0000000 --- a/src/app/article/[slug]/_components/commentList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./commentList"; diff --git a/src/app/article/[slug]/page.tsx b/src/app/article/[slug]/page.tsx deleted file mode 100644 index 311d170..0000000 --- a/src/app/article/[slug]/page.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Col, Row } from "react-bootstrap"; -import { Suspense } from "react"; -import { fetchCurrentUser } from "@/modules/features/auth/fetch/fetchCurrentUser"; -import { getSession } from "@/utils/auth/session"; -import { ArticleArea } from "./_components/articleArea"; -import { CommentForm } from "./_components/commentForm"; -import { CommentList } from "./_components/commentList"; - -type Params = Promise<{ - slug: string; -}>; - -const Page = async (props: { params: Params }) => { - const currentUserPromise = (await getSession()) ? fetchCurrentUser() : undefined; - const params = await props.params; - - return ( - - - - - ⌛Loading comments...

}> - -
- -
-
- ); -}; - -export default Page; diff --git a/src/app/articles/page.tsx b/src/app/articles/page.tsx deleted file mode 100644 index dcff1fe..0000000 --- a/src/app/articles/page.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { Container, Col, Row } from "react-bootstrap"; -import { getSession } from "@/utils/auth/session"; -import { ExhaustiveError } from "@/utils/errors"; -import clsx from "clsx"; -import Link from "next/link"; -import { Suspense } from "react"; -import { FeedArticleList } from "../_components/feedArticleList"; -import { GlobalArticleList } from "../_components/globalArticleList"; -import { TagArticleList } from "../_components/tagArticleList"; -import { TagList } from "../_components/tagList"; -import { SearchParams } from "../_types"; -//import { ArticlesList } from "./_components/articlesList"; - -const ArticleList = (searchParams: SearchParams) => { - switch (searchParams.tab) { - case "yours": - return ; - case "global": - return ; - case "tag": - return ; - default: - throw new ExhaustiveError(searchParams.tab, "all tab cases are not covered"); - } -}; - -const Page = async (props: { searchParams: Promise<{ [key: string]: string | string[] | undefined }> }) => { - const session = await getSession(); - const searchParams = SearchParams.parse(await props.searchParams); - - return ( -
- -
- - -
-
    - {session && ( -
  • - - Your Feed - -
  • - )} -
  • - - Global Feed - -
  • - {searchParams.tag && ( -
  • - - #{searchParams.tag} - -
  • - )} -
-
- ⌛Chargement...

}> - -
- - - ⌛Chargement...

}> - -
- -
-
-
- ); -}; - -export default Page; diff --git a/src/app/editor/[slug]/page.tsx b/src/app/editor/[slug]/page.tsx deleted file mode 100644 index b8da965..0000000 --- a/src/app/editor/[slug]/page.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { Container, Col, Row } from "react-bootstrap"; -import { UpdateArticleEditor } from "@/modules/features/article/components/articleEditor"; -import { fetchArticle } from "@/modules/features/article/fetch/fetchArticle"; -import { Suspense } from "react"; - -type Props = { - params: Promise<{ - slug: string; - }>; -}; - -const Page = async ({ params }: Props) => { - const article = fetchArticle((await params).slug); - - return ( -
- - - - ⌛ Chargement...

}> - -
- -
-
-
- ); -}; - -export default Page; diff --git a/src/app/editor/page.tsx b/src/app/editor/page.tsx deleted file mode 100644 index f68f9d1..0000000 --- a/src/app/editor/page.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Container, Col, Row } from "react-bootstrap"; -import { CreateArticleEditor } from "@/modules/features/article/components/articleEditor"; - -const Page = () => ( -
- - - - - - - -
-); - -export default Page; diff --git a/src/app/error.tsx b/src/app/error.tsx deleted file mode 100644 index 5926276..0000000 --- a/src/app/error.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; - -//import { Button } from "@/modules/common/components/button"; -import { Container, Button, Col, Row } from "react-bootstrap"; -import TimeClock from "./_components/timeClock/timeClock"; - -const Error = ({ - reset, -}: { - error: Error & { - digest?: string; - }; - reset: () => void; -}) => { - return ( -
- - - -

⚠️ Page introuvable!

-

La page que vous vouliez consulter n'est pas d'isponible pour le moment.

- - - - -
-
- - - -
- ); -}; - -export default Error; diff --git a/src/app/layout.tsx b/src/app/layout.tsx deleted file mode 100644 index 2bd51b9..0000000 --- a/src/app/layout.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { Footer } from "@/modules/common/components/footer"; -import { Header } from "@/modules/features/auth/components/header"; -//import "@/styles/font.css"; -import "@/styles/styles.scss"; -import "@/styles/icomoon.scss"; -//import "ionicons/css/ionicons.min.css"; -import type { Viewport } from "next"; -import { ReactNode } from "react"; - -export const fetchCache = "default-no-store"; - -export const viewport: Viewport = { - width: 'device-width', - initialScale: 1, - maximumScale: 1, - userScalable: false, - themeColor: "#00a3ff", -} - -export async function generateMetadata() { - return { - title: "Ad Astra", - description: "Ad Astra, fleurs et résines de CBD et autre cannabinoïdes.", - manifest: "/favicon/manifest.json", - icons: { - icon: [ - { url: '/favicon/android-icon-192x192.png', sizes: '192x192', type: 'image/png' }, - { url: '/favicon/favicon-16x16.png', sizes: '16x16', type: 'image/png' }, - { url: '/favicon/favicon-32x32.png', sizes: '32x32', type: 'image/png' }, - { url: '/favicon/favicon-96x96.png', sizes: '96x96', type: 'image/png' }, - ], - shortcut: [ - { url: '/favicon/favicon.ico', type:'image/vnd.microsoft.icon'} - ], - apple: [ - { url: '/favicon/apple-icon-57x57.png', sizes: '57x57', type: 'image/png' }, - { url: '/favicon/apple-icon-60x60.png', sizes: '60x60', type: 'image/png' }, - { url: '/favicon/apple-icon-72x72.png', sizes: '72x72', type: 'image/png' }, - { url: '/favicon/apple-icon-76x76.png', sizes: '76x76', type: 'image/png' }, - { url: '/favicon/apple-icon-114x114.png', sizes: '114x114', type: 'image/png' }, - { url: '/favicon/apple-icon-120x120.png', sizes: '120x120', type: 'image/png' }, - { url: '/favicon/apple-icon-144x144.png', sizes: '144x144', type: 'image/png' }, - { url: '/favicon/apple-icon-180x180.png', sizes: '180x180', type: 'image/png' }, - ], - }, - other: { - 'msapplication-TileColor': '#da532c', - 'msapplication-TileImage': `${'images/tileimage.jpg'}`, - 'msapplication-config': '/favicon/browserconfig.xml', - } - } -} - -const RootLayout = ({ - children, -}: Readonly<{ - children: ReactNode; -}>) => { - return ( - - -
-
- {children} -
-