From e89f8c73fe646e43f66a9f869b56267557c96df5 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 23 Dec 2020 22:35:11 +0800 Subject: ... --- FrontEnd/src/app/services/user.ts | 4 ++++ .../app/views/timeline-common/TimelineCardTemplate.tsx | 9 +++++++++ .../app/views/timeline-common/TimelinePageTemplate.tsx | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) (limited to 'FrontEnd/src') diff --git a/FrontEnd/src/app/services/user.ts b/FrontEnd/src/app/services/user.ts index 0166bce0..7a60b474 100644 --- a/FrontEnd/src/app/services/user.ts +++ b/FrontEnd/src/app/services/user.ts @@ -43,6 +43,10 @@ export class AuthUser implements User { get hasAllTimelineAdministrationPermission(): boolean { return this.permissions.includes("AllTimelineManagement"); } + + get hasHighlightTimelineAdministrationPermission(): boolean { + return this.permissions.includes("HighlightTimelineManagement"); + } } export interface LoginCredentials { diff --git a/FrontEnd/src/app/views/timeline-common/TimelineCardTemplate.tsx b/FrontEnd/src/app/views/timeline-common/TimelineCardTemplate.tsx index a47b3d76..ffec1a90 100644 --- a/FrontEnd/src/app/views/timeline-common/TimelineCardTemplate.tsx +++ b/FrontEnd/src/app/views/timeline-common/TimelineCardTemplate.tsx @@ -3,6 +3,7 @@ import clsx from "clsx"; import { useTranslation } from "react-i18next"; import { Dropdown, Button } from "react-bootstrap"; import Svg from "react-inlinesvg"; +import starIcon from "bootstrap-icons/icons/star.svg"; import bookmarkIcon from "bootstrap-icons/icons/bookmark.svg"; import { timelineVisibilityTooltipTranslationMap } from "@/services/timeline"; @@ -36,6 +37,7 @@ function TimelineCardTemplate({ infoArea, manageArea, onBookmark, + onHighlight, toggleCollapse, syncStatus, className, @@ -55,6 +57,13 @@ function TimelineCardTemplate({ {t(timelineVisibilityTooltipTranslationMap[timeline.visibility])}
+ {onHighlight != null ? ( + + ) : null} {onBookmark != null ? ( ( .put(name, user.token) .then(() => { pushAlert({ - message: "Succeeded to add bookmark!", //TODO: i18n + message: "Succeeded to add bookmark!", // TODO: i18n + type: "success", + }); + }); + } + : undefined, + onHighlight: + user != null && user.hasHighlightTimelineAdministrationPermission + ? () => { + void getHttpHighlightClient() + .put(name, user.token) + .then(() => { + pushAlert({ + message: "Succeeded to add highlight!", // TODO: i18n type: "success", }); }); -- cgit v1.2.3