From 4f301a32778fb006bcf2cc183c7118ca5961f7ba Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 3 Jan 2021 19:01:32 +0800 Subject: ... --- FrontEnd/src/app/views/home/BoardWithUser.tsx | 89 ++++++++++++++++++--------- FrontEnd/src/app/views/home/TimelineBoard.tsx | 46 +++++++------- FrontEnd/src/app/views/home/home.sass | 1 + 3 files changed, 83 insertions(+), 53 deletions(-) (limited to 'FrontEnd/src/app/views/home') diff --git a/FrontEnd/src/app/views/home/BoardWithUser.tsx b/FrontEnd/src/app/views/home/BoardWithUser.tsx index 7c736695..1c6f713a 100644 --- a/FrontEnd/src/app/views/home/BoardWithUser.tsx +++ b/FrontEnd/src/app/views/home/BoardWithUser.tsx @@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next"; import { AuthUser } from "@/services/user"; import { getHttpHighlightClient } from "@/http/highlight"; import { getHttpTimelineClient } from "@/http/timeline"; +import { getHttpBookmarkClient } from "@/http/bookmark"; import TimelineBoard from "./TimelineBoard"; @@ -12,36 +13,64 @@ const BoardWithUser: React.FC<{ user: AuthUser }> = ({ user }) => { const { t } = useTranslation(); return ( - - - getHttpHighlightClient().list()} - editHandler={ - user.hasHighlightTimelineAdministrationPermission - ? { - onDelete: () => { - // TODO: Implement this. - return Promise.resolve(); - }, - onMove: () => { - // TODO: Implement this. - return Promise.resolve(); - }, - } - : undefined - } - /> - - - - getHttpTimelineClient().listTimeline({ relate: user.username }) - } - /> - - + <> + + + getHttpBookmarkClient().list(user.token)} + editHandler={{ + onDelete: () => { + // TODO: Implement this. + return Promise.resolve(); + }, + onMove: () => { + // TODO: Implement this. + return Promise.resolve(); + }, + }} + /> + + + + getHttpTimelineClient().listTimeline({ relate: user.username }) + } + /> + + + + + getHttpHighlightClient().list()} + editHandler={ + user.hasHighlightTimelineAdministrationPermission + ? { + onDelete: () => { + // TODO: Implement this. + return Promise.resolve(); + }, + onMove: () => { + // TODO: Implement this. + return Promise.resolve(); + }, + } + : undefined + } + /> + + + + getHttpTimelineClient().listTimeline({ visibility: "Public" }) + } + /> + + + ); }; diff --git a/FrontEnd/src/app/views/home/TimelineBoard.tsx b/FrontEnd/src/app/views/home/TimelineBoard.tsx index bb3f5947..083f4034 100644 --- a/FrontEnd/src/app/views/home/TimelineBoard.tsx +++ b/FrontEnd/src/app/views/home/TimelineBoard.tsx @@ -1,7 +1,7 @@ import React from "react"; import clsx from "clsx"; import { Link } from "react-router-dom"; -import { Trans } from "react-i18next"; +import { Trans, useTranslation } from "react-i18next"; import { Spinner } from "react-bootstrap"; import { TimelineInfo } from "@/services/timeline"; @@ -218,6 +218,8 @@ interface TimelineBoardUIProps { const TimelineBoardUI: React.FC = (props) => { const { title, timelines, className, editHandler } = props; + const { t } = useTranslation(); + const editable = editHandler != null; const [editing, setEditing] = React.useState(false); @@ -226,28 +228,26 @@ const TimelineBoardUI: React.FC = (props) => {
{title != null &&

{title}

} - { - editable && - (editing ? ( -
{ - setEditing(false); - }} - > - Done -
- ) : ( -
{ - setEditing(true); - }} - > - Edit -
- )) // TODO: i18n - } + {editable && + (editing ? ( +
{ + setEditing(false); + }} + > + {t("done")} +
+ ) : ( +
{ + setEditing(true); + }} + > + {t("edit")} +
+ ))}
{(() => { if (timelines === "loading") { diff --git a/FrontEnd/src/app/views/home/home.sass b/FrontEnd/src/app/views/home/home.sass index 6af1b6d8..4b86f241 100644 --- a/FrontEnd/src/app/views/home/home.sass +++ b/FrontEnd/src/app/views/home/home.sass @@ -4,6 +4,7 @@ @extend .flex-column @extend .py-3 min-height: 200px + height: 100% position: relative .timeline-board-header -- cgit v1.2.3