From bc6cb242a88eba7874809d2464397375aaad5828 Mon Sep 17 00:00:00 2001 From: tomolld Date: Sat, 1 Mar 2025 13:41:46 +0900 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=83=97=E3=83=AD=E3=83=91?= =?UTF-8?q?=E3=83=86=E3=82=A3=E3=81=AE=E5=8F=96=E5=BE=97=E3=83=AD=E3=82=B8?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=82=92=E6=94=B9=E5=96=84=E3=81=97=E3=80=81?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=82=A2=E3=83=90=E3=82=BF?= =?UTF-8?q?=E3=83=BC=E3=81=AE=E8=A1=A8=E7=A4=BA=E3=82=92=E6=9C=80=E9=81=A9?= =?UTF-8?q?=E5=8C=96=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82=E3=81=BE?= =?UTF-8?q?=E3=81=9F=E3=80=81=E3=83=9E=E3=83=AB=E3=83=81=E3=83=AA=E3=83=B3?= =?UTF-8?q?=E3=82=AC=E3=83=AB=E3=82=B3=E3=83=9F=E3=83=A5=E3=83=8B=E3=83=86?= =?UTF-8?q?=E3=82=A3=E3=81=AE=E8=AA=AC=E6=98=8E=E6=96=87=E3=82=92=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next/prisma/seed.ts | 32 ++-- .../page-comment-list-client.tsx | 142 +++++++++--------- .../page/[slug]/components/sub-header.tsx | 13 +- .../components/header/base-header-layout.tsx | 10 +- .../header/notifications-dropdown/client.tsx | 10 +- 5 files changed, 115 insertions(+), 92 deletions(-) diff --git a/next/prisma/seed.ts b/next/prisma/seed.ts index 9afe4294..93ed7696 100644 --- a/next/prisma/seed.ts +++ b/next/prisma/seed.ts @@ -3,37 +3,37 @@ import { PrismaClient } from "@prisma/client"; const prisma = new PrismaClient(); const JA_NUMBER_0 = "世界とつながる"; -const JA_NUMBER_1 = `Evameは、あなたが書いた記事を多言語に翻訳し、世界中の読者へ届けるコミュニティです。 +const JA_NUMBER_1 = `Evameは、あなたが書いた記事もコメントも自動で翻訳される多言語コミュニティです。 メニューから好きな言語を選ぶだけで、記事やコメントを思いのままに楽しめます。 海外の読者とも手軽に交流でき、新たな出会いが生まれるかもしれません。 さあ、Evameであなたのアイデアや物語を世界に向けて発信してみましょう。`; const EN_NUMBER_0: string = "Connect with the world"; -const EN_NUMBER_1 = `Evame is a community that translates the articles you write into multiple languages and delivers them to readers around the world. -By simply selecting your preferred language from the menu, you can enjoy articles and comments however you like. -You can also easily interact with readers overseas, potentially creating new connections. -Now, let's share your ideas and stories with the world through Evame!`; +const EN_NUMBER_1 = `Evame is a multilingual community where your articles and comments are automatically translated. +Just select your preferred language from the menu, and enjoy articles and comments freely. +You can easily interact with international readers, which might lead to new encounters. +Come on, let's share your ideas and stories with the world through Evame.`; // 中国語(簡体字)版 const ZH_NUMBER_0: string = "与世界相连"; -const ZH_NUMBER_1 = `Evame 是一个将您所写的文章翻译成多种语言并传播给全世界读者的社区。 -只需从菜单中选择您喜欢的语言,就能随心所欲地阅读文章和评论。 -您也可以轻松地与海外读者互动,或许会结识新的朋友。 -现在,就让我们通过 Evame 向全世界分享您的想法和故事吧!`; +const ZH_NUMBER_1 = `Evame是一个多语言社区,您撰写的文章和评论都会被自动翻译。 +只需从菜单中选择您喜欢的语言,您就可以随心所欲地享受文章和评论。 +您可以轻松地与海外读者交流,这可能会带来新的相遇。 +来吧,让我们通过Evame向世界分享您的想法和故事。`; // 韓国語版 const KO_NUMBER_0: string = "세상과 연결되다"; -const KO_NUMBER_1 = `Evame는 당신이 작성한 기사를 여러 언어로 번역하여 전 세계 독자들에게 전달하는 커뮤니ティ입니다. -메뉴에서 원하는 언어를 선택하기만 하면 기사와 댓글을 원하는 대로 즐길 수 있습니다. +const KO_NUMBER_1 = `Evame는 당신이 작성한 글과 댓글이 자동으로 번역되는 다국어 커뮤니티입니다. +메뉴에서 원하는 언어를 선택하기만 하면 글과 댓글을 마음껏 즐길 수 있습니다. 해외 독자들과도 쉽게 교류할 수 있어 새로운 만남이 생길지도 모릅니다. -이제 Evame를 통해 당신의 아이디어와 이야기를 전 세계에 전해보세요!`; +자, Evame에서 당신의 아이디어와 이야기를 세계로 발신해 보세요.`; // スペイン語版 const ES_NUMBER_0: string = "Conéctate con el mundo"; -const ES_NUMBER_1 = `Evame es una comunidad que traduce los artículos que escribes a varios idiomas y los lleva a lectores de todo el mundo. -Con solo elegir tu idioma preferido en el menú, puedes disfrutar de artículos y comentarios de la manera que más te guste. -También puedes interactuar fácilmente con lectores de otros países, lo que podría dar lugar a nuevos encuentros. -¡Ahora, comparte tus ideas e historias con el mundo a través de Evame!`; +const ES_NUMBER_1 = `Evame es una comunidad multilingüe donde tus artículos y comentarios se traducen automáticamente. +Solo selecciona el idioma que prefieras del menú y disfruta de los artículos y comentarios libremente. +Puedes interactuar fácilmente con lectores internacionales, lo que podría conducir a nuevos encuentros. +Vamos, compartamos tus ideas e historias con el mundo a través de Evame.`; async function seed() { await addRequiredData(); diff --git a/next/src/app/[locale]/(common-layout)/user/[handle]/page/[slug]/comment/components/page-comment-list/page-comment-list-client.tsx b/next/src/app/[locale]/(common-layout)/user/[handle]/page/[slug]/comment/components/page-comment-list/page-comment-list-client.tsx index 6c780c7b..9154f2d7 100644 --- a/next/src/app/[locale]/(common-layout)/user/[handle]/page/[slug]/comment/components/page-comment-list/page-comment-list-client.tsx +++ b/next/src/app/[locale]/(common-layout)/user/[handle]/page/[slug]/comment/components/page-comment-list/page-comment-list-client.tsx @@ -12,6 +12,7 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { MoreVertical } from "lucide-react"; +import { getImageProps } from "next/image"; import { useActionState } from "react"; import { type CommentDeleteActionResponse, @@ -34,78 +35,83 @@ export function PageCommentListClient({ >(commentDeleteAction, { success: false }); return (
- {pageCommentsWithUser.map((pageComment) => ( -
-
- - - - {pageComment.user?.name.charAt(0) || "?"} - - -
-
-
- - {pageComment.user?.name || "deleted_user"} - - - {pageComment.createdAt} - + {pageCommentsWithUser.map((pageComment) => { + const { props } = getImageProps({ + src: pageComment.user.image, + alt: pageComment.user.name, + width: 40, + height: 40, + }); + return ( +
+
+ + + + {pageComment.user?.name.charAt(0) || "?"} + + +
+
+
+ + {pageComment.user?.name || "deleted_user"} + + + {pageComment.createdAt} + +
+ {currentHandle === pageComment.user.handle && ( + + + + + + +
+ + + +
+
+
+
+ )}
- {currentHandle === pageComment.user.handle && ( - - - - - - -
- - - -
-
-
-
- )}
+
+ +
-
- -
-
- ))} + ); + })}
); } diff --git a/next/src/app/[locale]/(common-layout)/user/[handle]/page/[slug]/components/sub-header.tsx b/next/src/app/[locale]/(common-layout)/user/[handle]/page/[slug]/components/sub-header.tsx index e0cf622d..8da27fc4 100644 --- a/next/src/app/[locale]/(common-layout)/user/[handle]/page/[slug]/components/sub-header.tsx +++ b/next/src/app/[locale]/(common-layout)/user/[handle]/page/[slug]/components/sub-header.tsx @@ -5,6 +5,7 @@ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Button } from "@/components/ui/button"; import { Link } from "@/i18n/routing"; import { ChevronDown, List } from "lucide-react"; +import { getImageProps } from "next/image"; import { useState } from "react"; import Toc, { useHasTableOfContents } from "./toc"; @@ -53,7 +54,12 @@ export function SubHeader({ ); }; - + const { props } = getImageProps({ + src: pageWithTranslations.user.image, + alt: pageWithTranslations.user.name, + width: 40, + height: 40, + }); return (
- + {pageWithTranslations.user.name.charAt(0).toUpperCase()} diff --git a/next/src/app/[locale]/components/header/base-header-layout.tsx b/next/src/app/[locale]/components/header/base-header-layout.tsx index 25d52a8b..2caaff03 100644 --- a/next/src/app/[locale]/components/header/base-header-layout.tsx +++ b/next/src/app/[locale]/components/header/base-header-layout.tsx @@ -12,6 +12,7 @@ import { import { Link } from "@/i18n/routing"; import { LogOutIcon, SettingsIcon } from "lucide-react"; import Image from "next/image"; +import { getImageProps } from "next/image"; import type { ReactNode } from "react"; import { ModeToggle } from "../mode-toggle"; import { useHeaderScroll } from "./hooks/use-header-scroll"; @@ -31,7 +32,12 @@ export function BaseHeaderLayout({ }: BaseHeaderLayoutProps) { // カスタムフックを使用 const { headerRef, isPinned, isVisible, headerHeight } = useHeaderScroll(); - + const { props } = getImageProps({ + src: currentUser?.image || "", + alt: currentUser?.name || "", + width: 40, + height: 40, + }); return (
- + {currentUser.handle.charAt(0).toUpperCase()} diff --git a/next/src/app/[locale]/components/header/notifications-dropdown/client.tsx b/next/src/app/[locale]/components/header/notifications-dropdown/client.tsx index c9446339..32473d9d 100644 --- a/next/src/app/[locale]/components/header/notifications-dropdown/client.tsx +++ b/next/src/app/[locale]/components/header/notifications-dropdown/client.tsx @@ -10,9 +10,11 @@ import { } from "@/components/ui/dropdown-menu"; import { Link } from "@/i18n/routing"; import { Bell } from "lucide-react"; +import { getImageProps } from "next/image"; import { startTransition, useActionState } from "react"; import { markNotificationAsReadAction } from "./action"; import type { NotificationWithRelations } from "./db/queries.server"; + export function NotificationsDropdownClient({ notifications, currentUserHandle, @@ -196,13 +198,19 @@ function NotificationAvatar({ }: { actor: { handle: string; image: string; name: string }; }) { + const { props } = getImageProps({ + src: actor.image, + alt: actor.name, + width: 40, + height: 40, + }); return ( - + {actor.name.charAt(0).toUpperCase()}