diff --git a/README.md b/README.md index 5cd1cd59..0991c5f2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # memos -✍️ memos +✍️ memos A privacy-first, lightweight note-taking service. Easily capture and share your great thoughts. diff --git a/web/index.html b/web/index.html index eb4c54c9..6a5e4e56 100644 --- a/web/index.html +++ b/web/index.html @@ -2,7 +2,7 @@ - + diff --git a/web/public/logo.png b/web/public/logo.png new file mode 100644 index 00000000..c16e71c5 Binary files /dev/null and b/web/public/logo.png differ diff --git a/web/public/manifest.json b/web/public/manifest.json index 74794c0b..5a3982ad 100644 --- a/web/public/manifest.json +++ b/web/public/manifest.json @@ -4,9 +4,8 @@ "description": "usememos/memos", "icons": [ { - "src": "/logo.webp", - "type": "image/webp", - "sizes": "520x520" + "src": "/logo.png", + "type": "image/png" } ], "start_url": "/", diff --git a/web/src/App.tsx b/web/src/App.tsx index d7805007..bb697563 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -70,7 +70,7 @@ const App = () => { // dynamic update metadata with customized profile. document.title = systemStatus.customizedProfile.name; const link = document.querySelector("link[rel~='icon']") as HTMLLinkElement; - link.href = systemStatus.customizedProfile.logoUrl || "/logo.webp"; + link.href = systemStatus.customizedProfile.logoUrl || "/logo.png"; }, [systemStatus.customizedProfile]); useEffect(() => { diff --git a/web/src/components/AboutSiteDialog.tsx b/web/src/components/AboutSiteDialog.tsx index 54f9fe24..ae606236 100644 --- a/web/src/components/AboutSiteDialog.tsx +++ b/web/src/components/AboutSiteDialog.tsx @@ -33,17 +33,17 @@ const AboutSiteDialog: React.FC = ({ destroy }: Props) => {
{t("about.powered-by")} - + memos v{profile.version}
-
+
{t("about.other-projects")}: - + Slash = ({ destroy }: Props) => { className="flex items-center underline text-blue-600 hover:opacity-80" > diff --git a/web/src/components/UpdateCustomizedProfileDialog.tsx b/web/src/components/UpdateCustomizedProfileDialog.tsx index 4e10fb2b..b951224d 100644 --- a/web/src/components/UpdateCustomizedProfileDialog.tsx +++ b/web/src/components/UpdateCustomizedProfileDialog.tsx @@ -63,7 +63,7 @@ const UpdateCustomizedProfileDialog: React.FC = ({ destroy }: Props) => { const handleRestoreButtonClick = () => { setPartialState({ name: "memos", - logoUrl: "/logo.webp", + logoUrl: "/logo.png", description: "", locale: "en", appearance: "system", diff --git a/web/src/components/UserAvatar.tsx b/web/src/components/UserAvatar.tsx index 6488fd6c..c5353afd 100644 --- a/web/src/components/UserAvatar.tsx +++ b/web/src/components/UserAvatar.tsx @@ -11,7 +11,7 @@ const UserAvatar = (props: Props) => {
diff --git a/web/src/pages/MemoDetail.tsx b/web/src/pages/MemoDetail.tsx index 32ee194e..e4d094cb 100644 --- a/web/src/pages/MemoDetail.tsx +++ b/web/src/pages/MemoDetail.tsx @@ -14,7 +14,6 @@ import MemoResourceListView from "@/components/MemoResourceListView"; import showShareMemoDialog from "@/components/ShareMemoDialog"; import UserAvatar from "@/components/UserAvatar"; import VisibilityIcon from "@/components/VisibilityIcon"; -import { memoServiceClient } from "@/grpcweb"; import { UNKNOWN_ID, VISIBILITY_SELECTOR_ITEMS } from "@/helpers/consts"; import { getDateTimeString } from "@/helpers/datetime"; import useCurrentUser from "@/hooks/useCurrentUser"; @@ -25,15 +24,14 @@ import { User } from "@/types/proto/api/v2/user_service"; import { useTranslate } from "@/utils/i18n"; const MemoDetail = () => { + const t = useTranslate(); const params = useParams(); const navigateTo = useNavigateTo(); - const t = useTranslate(); const globalStore = useGlobalStore(); const memoStore = useMemoStore(); const userV1Store = useUserV1Store(); const currentUser = useCurrentUser(); - const [user, setUser] = useState(); - const [comments, setComments] = useState([]); + const [creator, setCreator] = useState(); const { systemStatus } = globalStore.state; const memoId = Number(params.memoId); const memo = memoStore.state.memos.find((memo) => memo.id === memoId); @@ -42,6 +40,10 @@ const MemoDetail = () => { memo?.relationList.filter( (relation) => relation.memoId === memo?.id && relation.relatedMemoId !== memo?.id && relation.type === "REFERENCE" ) || []; + const commentRelations = memo?.relationList.filter((relation) => relation.relatedMemoId === memo.id && relation.type === "COMMENT") || []; + const comments = commentRelations + .map((relation) => memoStore.state.memos.find((memo) => memo.id === relation.memoId)) + .filter((memo) => memo) as Memo[]; // Prepare memo. useEffect(() => { @@ -50,7 +52,7 @@ const MemoDetail = () => { .fetchMemoById(memoId) .then(async (memo) => { const user = await userV1Store.getOrFetchUserByUsername(memo.creatorUsername); - setUser(user); + setCreator(user); }) .catch((error) => { console.error(error); @@ -67,20 +69,19 @@ const MemoDetail = () => { return; } - fetchMemoComments(); - }, [memo]); + (async () => { + await fetchMemoComments(); + })(); + }, [memo?.relationList]); const fetchMemoComments = async () => { if (!memo) { return; } - const { memos } = await memoServiceClient.listMemoComments({ - id: memo.id, - }); - const requests = memos.map((memo) => memoStore.fetchMemoById(memo.id)); - const composedMemos = await Promise.all(requests); - setComments(composedMemos); + const commentRelations = memo.relationList.filter((relation) => relation.relatedMemoId === memo.id && relation.type === "COMMENT"); + const requests = commentRelations.map((relation) => memoStore.fetchMemoById(relation.memoId)); + await Promise.all(requests); }; if (!memo) { @@ -135,8 +136,8 @@ const MemoDetail = () => { - - {user?.nickname} + + {creator?.nickname} {allowEdit && ( <> diff --git a/web/src/store/module/global.ts b/web/src/store/module/global.ts index 1469b266..48d25347 100644 --- a/web/src/store/module/global.ts +++ b/web/src/store/module/global.ts @@ -21,7 +21,7 @@ export const initialGlobalState = async () => { memoDisplayWithUpdatedTs: false, customizedProfile: { name: "memos", - logoUrl: "/logo.webp", + logoUrl: "/logo.png", description: "", locale: "en", appearance: "system", @@ -45,7 +45,7 @@ export const initialGlobalState = async () => { ...data, customizedProfile: { name: customizedProfile.name || "memos", - logoUrl: customizedProfile.logoUrl || "/logo.webp", + logoUrl: customizedProfile.logoUrl || "/logo.png", description: customizedProfile.description, locale: customizedProfile.locale || "en", appearance: customizedProfile.appearance || "system", diff --git a/web/src/store/reducer/global.ts b/web/src/store/reducer/global.ts index d7fa7335..eb000771 100644 --- a/web/src/store/reducer/global.ts +++ b/web/src/store/reducer/global.ts @@ -26,7 +26,7 @@ const globalSlice = createSlice({ memoDisplayWithUpdatedTs: false, customizedProfile: { name: "memos", - logoUrl: "/logo.webp", + logoUrl: "/logo.png", description: "", locale: "en", appearance: "system", diff --git a/web/src/types/modules/resource.d.ts b/web/src/types/modules/resource.d.ts index b37e2bec..dc80ed84 100644 --- a/web/src/types/modules/resource.d.ts +++ b/web/src/types/modules/resource.d.ts @@ -5,14 +5,3 @@ interface ResourceCreate { externalLink: string; type: string; } - -interface ResourcePatch { - id: ResourceId; - filename?: string; - memoId?: number; -} - -interface ResourceFind { - offset?: number; - limit?: number; -} diff --git a/web/src/types/modules/tag.d.ts b/web/src/types/modules/tag.d.ts deleted file mode 100644 index beda8fca..00000000 --- a/web/src/types/modules/tag.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -interface TagFind { - creatorUsername?: string; -}