feat: migrate activity screen to i18n
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
import { User } from "@lume/ark";
|
import { User } from "@lume/ark";
|
||||||
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
export function ActivityRepost({ event }: { event: NDKEvent }) {
|
export function ActivityRepost({ event }: { event: NDKEvent }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
to={`/activity/${event.id}`}
|
to={`/activity/${event.id}`}
|
||||||
@@ -14,7 +17,7 @@ export function ActivityRepost({ event }: { event: NDKEvent }) {
|
|||||||
<User.Avatar className="size-8 rounded-lg shrink-0" />
|
<User.Avatar className="size-8 rounded-lg shrink-0" />
|
||||||
<div className="inline-flex items-center gap-1.5">
|
<div className="inline-flex items-center gap-1.5">
|
||||||
<User.Name className="max-w-[8rem] font-semibold text-neutral-950 dark:text-neutral-50" />
|
<User.Name className="max-w-[8rem] font-semibold text-neutral-950 dark:text-neutral-50" />
|
||||||
<p className="shrink-0">reposted</p>
|
<p className="shrink-0">{t("activity.repost")}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<User.Time
|
<User.Time
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import { User } from "@lume/ark";
|
import { User } from "@lume/ark";
|
||||||
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
export function ActivityText({ event }: { event: NDKEvent }) {
|
export function ActivityText({ event }: { event: NDKEvent }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
to={`/activity/${event.id}`}
|
to={`/activity/${event.id}`}
|
||||||
@@ -14,7 +17,7 @@ export function ActivityText({ event }: { event: NDKEvent }) {
|
|||||||
<User.Avatar className="size-8 rounded-lg shrink-0" />
|
<User.Avatar className="size-8 rounded-lg shrink-0" />
|
||||||
<div className="inline-flex items-center gap-1.5">
|
<div className="inline-flex items-center gap-1.5">
|
||||||
<User.Name className="max-w-[8rem] font-semibold text-neutral-950 dark:text-neutral-50" />
|
<User.Name className="max-w-[8rem] font-semibold text-neutral-950 dark:text-neutral-50" />
|
||||||
<p className="shrink-0">mention you</p>
|
<p className="shrink-0">{t("activity.mention")}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<User.Time
|
<User.Time
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { User } from "@lume/ark";
|
import { User } from "@lume/ark";
|
||||||
import { compactNumber } from "@lume/utils";
|
import { compactNumber } from "@lume/utils";
|
||||||
import { NDKEvent, zapInvoiceFromEvent } from "@nostr-dev-kit/ndk";
|
import { NDKEvent, zapInvoiceFromEvent } from "@nostr-dev-kit/ndk";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
export function ActivityZap({ event }: { event: NDKEvent }) {
|
export function ActivityZap({ event }: { event: NDKEvent }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
const invoice = zapInvoiceFromEvent(event);
|
const invoice = zapInvoiceFromEvent(event);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -18,7 +20,7 @@ export function ActivityZap({ event }: { event: NDKEvent }) {
|
|||||||
<div className="inline-flex items-center gap-1.5">
|
<div className="inline-flex items-center gap-1.5">
|
||||||
<User.Name className="max-w-[8rem] font-semibold text-neutral-950 dark:text-neutral-50" />
|
<User.Name className="max-w-[8rem] font-semibold text-neutral-950 dark:text-neutral-50" />
|
||||||
<p className="shrink-0">
|
<p className="shrink-0">
|
||||||
zapped {compactNumber.format(invoice.amount)} sats
|
{t("activity.zap")} {compactNumber.format(invoice.amount)} sats
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { FETCH_LIMIT } from "@lume/utils";
|
|||||||
import { NDKEvent, NDKKind } from "@nostr-dev-kit/ndk";
|
import { NDKEvent, NDKKind } from "@nostr-dev-kit/ndk";
|
||||||
import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query";
|
import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { ActivityRepost } from "./activityRepost";
|
import { ActivityRepost } from "./activityRepost";
|
||||||
import { ActivityText } from "./activityText";
|
import { ActivityText } from "./activityText";
|
||||||
import { ActivityZap } from "./activityZap";
|
import { ActivityZap } from "./activityZap";
|
||||||
@@ -12,6 +13,7 @@ export function ActivityList() {
|
|||||||
const ark = useArk();
|
const ark = useArk();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
const { data, hasNextPage, isLoading, isFetchingNextPage, fetchNextPage } =
|
const { data, hasNextPage, isLoading, isFetchingNextPage, fetchNextPage } =
|
||||||
useInfiniteQuery({
|
useInfiniteQuery({
|
||||||
queryKey: ["activity"],
|
queryKey: ["activity"],
|
||||||
@@ -86,7 +88,7 @@ export function ActivityList() {
|
|||||||
) : !allEvents.length ? (
|
) : !allEvents.length ? (
|
||||||
<div className="w-full h-full flex flex-col items-center justify-center">
|
<div className="w-full h-full flex flex-col items-center justify-center">
|
||||||
<p className="mb-2 text-2xl">🎉</p>
|
<p className="mb-2 text-2xl">🎉</p>
|
||||||
<p className="text-center font-medium">Yo! Nothing new yet.</p>
|
<p className="text-center font-medium">{t("activity.empty")}</p>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
allEvents.map((event) => renderEvenKind(event))
|
allEvents.map((event) => renderEvenKind(event))
|
||||||
@@ -104,7 +106,7 @@ export function ActivityList() {
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<ArrowRightCircleIcon className="size-5" />
|
<ArrowRightCircleIcon className="size-5" />
|
||||||
Load more
|
{t("global.loadMore")}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
import { User } from "@lume/ark";
|
import { User } from "@lume/ark";
|
||||||
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { ActivityRootNote } from "./rootNote";
|
import { ActivityRootNote } from "./rootNote";
|
||||||
|
|
||||||
export function ActivitySingleRepost({ event }: { event: NDKEvent }) {
|
export function ActivitySingleRepost({ event }: { event: NDKEvent }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
const repostId = event.tags.find((el) => el[0] === "e")[1];
|
const repostId = event.tags.find((el) => el[0] === "e")[1];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="pb-3 flex flex-col">
|
<div className="pb-3 flex flex-col">
|
||||||
<div className="h-14 shrink-0 border-b border-neutral-100 dark:border-neutral-900 flex flex-col items-center justify-center px-3">
|
<div className="h-14 shrink-0 border-b border-neutral-100 dark:border-neutral-900 flex flex-col items-center justify-center px-3">
|
||||||
<h3 className="text-center font-semibold leading-tight">Boost</h3>
|
<h3 className="text-center font-semibold leading-tight">
|
||||||
|
{t("activity.boost")}
|
||||||
|
</h3>
|
||||||
<p className="text-sm text-blue-500 font-medium leading-tight">
|
<p className="text-sm text-blue-500 font-medium leading-tight">
|
||||||
@ Someone has reposted to your note
|
{t("activity.boostSubtitle")}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 min-h-0">
|
<div className="flex-1 min-h-0">
|
||||||
@@ -22,7 +26,7 @@ export function ActivitySingleRepost({ event }: { event: NDKEvent }) {
|
|||||||
</User.Provider>
|
</User.Provider>
|
||||||
<div className="flex flex-col items-center gap-3">
|
<div className="flex flex-col items-center gap-3">
|
||||||
<div className="h-4 w-px bg-blue-500" />
|
<div className="h-4 w-px bg-blue-500" />
|
||||||
<h3 className="font-semibold">Reposted</h3>
|
<h3 className="font-semibold capitalize">{t("activity.repost")}</h3>
|
||||||
<div className="h-4 w-px bg-blue-500" />
|
<div className="h-4 w-px bg-blue-500" />
|
||||||
</div>
|
</div>
|
||||||
<ActivityRootNote eventId={repostId} />
|
<ActivityRootNote eventId={repostId} />
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Note, useArk } from "@lume/ark";
|
import { Note, useArk } from "@lume/ark";
|
||||||
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { ActivityRootNote } from "./rootNote";
|
import { ActivityRootNote } from "./rootNote";
|
||||||
|
|
||||||
export function ActivitySingleText({ event }: { event: NDKEvent }) {
|
export function ActivitySingleText({ event }: { event: NDKEvent }) {
|
||||||
@@ -9,14 +10,16 @@ export function ActivitySingleText({ event }: { event: NDKEvent }) {
|
|||||||
tags: event.tags,
|
tags: event.tags,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full w-full flex flex-col justify-between">
|
<div className="h-full w-full flex flex-col justify-between">
|
||||||
<div className="h-14 border-b border-neutral-100 dark:border-neutral-900 flex flex-col items-center justify-center px-3">
|
<div className="h-14 border-b border-neutral-100 dark:border-neutral-900 flex flex-col items-center justify-center px-3">
|
||||||
<h3 className="text-center font-semibold leading-tight">
|
<h3 className="text-center font-semibold leading-tight">
|
||||||
Conversation
|
{t("activity.conversation")}
|
||||||
</h3>
|
</h3>
|
||||||
<p className="text-sm text-blue-500 font-medium leading-tight">
|
<p className="text-sm text-blue-500 font-medium leading-tight">
|
||||||
@ Someone has replied to your note
|
{t("activity.conversationSubtitle")}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="overflow-y-auto">
|
<div className="overflow-y-auto">
|
||||||
@@ -33,7 +36,9 @@ export function ActivitySingleText({ event }: { event: NDKEvent }) {
|
|||||||
) : null}
|
) : null}
|
||||||
<div className="mt-3 flex flex-col gap-3">
|
<div className="mt-3 flex flex-col gap-3">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<p className="text-teal-500 font-medium">New reply</p>
|
<p className="text-teal-500 font-medium">
|
||||||
|
{t("activity.newReply")}
|
||||||
|
</p>
|
||||||
<div className="flex-1 h-px bg-teal-300" />
|
<div className="flex-1 h-px bg-teal-300" />
|
||||||
<div className="w-4 shrink-0 h-px bg-teal-300" />
|
<div className="w-4 shrink-0 h-px bg-teal-300" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { activityUnreadAtom } from "@lume/utils";
|
import { activityUnreadAtom } from "@lume/utils";
|
||||||
import { useSetAtom } from "jotai";
|
import { useSetAtom } from "jotai";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { Outlet } from "react-router-dom";
|
import { Outlet } from "react-router-dom";
|
||||||
import { ActivityList } from "./components/list";
|
import { ActivityList } from "./components/list";
|
||||||
|
|
||||||
export function ActivityScreen() {
|
export function ActivityScreen() {
|
||||||
|
const { t } = useTranslation();
|
||||||
const setUnreadActivity = useSetAtom(activityUnreadAtom);
|
const setUnreadActivity = useSetAtom(activityUnreadAtom);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -15,7 +17,7 @@ export function ActivityScreen() {
|
|||||||
<div className="flex h-full w-full rounded-xl shadow-[rgba(50,_50,_105,_0.15)_0px_2px_5px_0px,_rgba(0,_0,_0,_0.05)_0px_1px_1px_0px] dark:shadow-none dark:ring-1 dark:ring-white/10">
|
<div className="flex h-full w-full rounded-xl shadow-[rgba(50,_50,_105,_0.15)_0px_2px_5px_0px,_rgba(0,_0,_0,_0.05)_0px_1px_1px_0px] dark:shadow-none dark:ring-1 dark:ring-white/10">
|
||||||
<div className="h-full flex flex-col w-96 shrink-0 rounded-l-xl bg-white/50 backdrop-blur-xl dark:bg-black/50">
|
<div className="h-full flex flex-col w-96 shrink-0 rounded-l-xl bg-white/50 backdrop-blur-xl dark:bg-black/50">
|
||||||
<div className="h-14 shrink-0 flex items-center px-5 text-lg font-semibold border-b border-black/10 dark:border-white/10">
|
<div className="h-14 shrink-0 flex items-center px-5 text-lg font-semibold border-b border-black/10 dark:border-white/10">
|
||||||
Activity
|
{t("activity.title")}
|
||||||
</div>
|
</div>
|
||||||
<ActivityList />
|
<ActivityList />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -279,5 +279,17 @@
|
|||||||
"subtitle": "You can exit the setup here and start using Lume.",
|
"subtitle": "You can exit the setup here and start using Lume.",
|
||||||
"report": "Report a issue"
|
"report": "Report a issue"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"activity": {
|
||||||
|
"title": "Activity",
|
||||||
|
"empty": "Yo! Nothing new yet.",
|
||||||
|
"mention": "mention you",
|
||||||
|
"repost": "reposted",
|
||||||
|
"zap": "zapped",
|
||||||
|
"newReply": "New reply",
|
||||||
|
"boost": "Boost",
|
||||||
|
"boostSubtitle": "@ Someone has reposted to your note",
|
||||||
|
"conversation": "Conversation",
|
||||||
|
"conversationSubtitle": "@ Someone has replied to your note"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,5 +279,17 @@
|
|||||||
"subtitle": "You can exit the setup here and start using Lume.",
|
"subtitle": "You can exit the setup here and start using Lume.",
|
||||||
"report": "Report a issue"
|
"report": "Report a issue"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"activity": {
|
||||||
|
"title": "Activity",
|
||||||
|
"empty": "Yo! Nothing new yet.",
|
||||||
|
"mention": "mention you",
|
||||||
|
"repost": "reposted",
|
||||||
|
"zap": "zapped",
|
||||||
|
"newReply": "New reply",
|
||||||
|
"boost": "Boost",
|
||||||
|
"boostSubtitle": "@ Someone has reposted to your note",
|
||||||
|
"conversation": "Conversation",
|
||||||
|
"conversationSubtitle": "@ Someone has replied to your note"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,5 +279,17 @@
|
|||||||
"subtitle": "You can exit the setup here and start using Lume.",
|
"subtitle": "You can exit the setup here and start using Lume.",
|
||||||
"report": "Report a issue"
|
"report": "Report a issue"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"activity": {
|
||||||
|
"title": "Activity",
|
||||||
|
"empty": "Yo! Nothing new yet.",
|
||||||
|
"mention": "mention you",
|
||||||
|
"repost": "reposted",
|
||||||
|
"zap": "zapped",
|
||||||
|
"newReply": "New reply",
|
||||||
|
"boost": "Boost",
|
||||||
|
"boostSubtitle": "@ Someone has reposted to your note",
|
||||||
|
"conversation": "Conversation",
|
||||||
|
"conversationSubtitle": "@ Someone has replied to your note"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,5 +279,17 @@
|
|||||||
"subtitle": "You can exit the setup here and start using Lume.",
|
"subtitle": "You can exit the setup here and start using Lume.",
|
||||||
"report": "Report a issue"
|
"report": "Report a issue"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"activity": {
|
||||||
|
"title": "Activity",
|
||||||
|
"empty": "Yo! Nothing new yet.",
|
||||||
|
"mention": "mention you",
|
||||||
|
"repost": "reposted",
|
||||||
|
"zap": "zapped",
|
||||||
|
"newReply": "New reply",
|
||||||
|
"boost": "Boost",
|
||||||
|
"boostSubtitle": "@ Someone has reposted to your note",
|
||||||
|
"conversation": "Conversation",
|
||||||
|
"conversationSubtitle": "@ Someone has replied to your note"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,5 +279,17 @@
|
|||||||
"subtitle": "You can exit the setup here and start using Lume.",
|
"subtitle": "You can exit the setup here and start using Lume.",
|
||||||
"report": "Report a issue"
|
"report": "Report a issue"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"activity": {
|
||||||
|
"title": "Activity",
|
||||||
|
"empty": "Yo! Nothing new yet.",
|
||||||
|
"mention": "mention you",
|
||||||
|
"repost": "reposted",
|
||||||
|
"zap": "zapped",
|
||||||
|
"newReply": "New reply",
|
||||||
|
"boost": "Boost",
|
||||||
|
"boostSubtitle": "@ Someone has reposted to your note",
|
||||||
|
"conversation": "Conversation",
|
||||||
|
"conversationSubtitle": "@ Someone has replied to your note"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user