aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-12-23 22:35:11 +0800
committercrupest <crupest@outlook.com>2020-12-23 22:35:11 +0800
commit5e8c5c4e145e1eef799b1b745438de4c34fd3471 (patch)
tree269b40d2030461fd6d997af343d6c15484bbed45 /FrontEnd/src
parentbe318ee2dbdc865c51dd7fc675cfb35c73e5b70b (diff)
downloadtimeline-5e8c5c4e145e1eef799b1b745438de4c34fd3471.tar.gz
timeline-5e8c5c4e145e1eef799b1b745438de4c34fd3471.tar.bz2
timeline-5e8c5c4e145e1eef799b1b745438de4c34fd3471.zip
...
Diffstat (limited to 'FrontEnd/src')
-rw-r--r--FrontEnd/src/app/services/user.ts4
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelineCardTemplate.tsx9
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx16
3 files changed, 28 insertions, 1 deletions
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])}
</small>
<div className="text-right mt-2">
+ {onHighlight != null ? (
+ <Svg
+ src={starIcon}
+ className="icon-button text-yellow mr-3"
+ onClick={onHighlight}
+ />
+ ) : null}
{onBookmark != null ? (
<Svg
src={bookmarkIcon}
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
index 3833cdd9..21720601 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
@@ -12,6 +12,7 @@ import {
useTimelineInfo,
} from "@/services/timeline";
import { getHttpBookmarkClient } from "@/http/bookmark";
+import { getHttpHighlightClient } from "@/http/highlight";
import { TimelineMemberDialog } from "./TimelineMember";
import TimelinePropertyChangeDialog from "./TimelinePropertyChangeDialog";
@@ -124,7 +125,20 @@ export default function TimelinePageTemplate<TManageItem>(
.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",
});
});