From c71c36fcc545a2ca9fa59fbcf68b626b0594e7f2 Mon Sep 17 00:00:00 2001
From: Myzel394 <50424412+Myzel394@users.noreply.github.com>
Date: Sun, 18 Dec 2022 14:37:59 +0100
Subject: [PATCH] adapated to new alias notes
---
public/locales/de-DE/translation.json | 12 +++++
public/locales/en-US/translation.json | 12 +++++
src/components/SimpleOverlayInformation.tsx | 12 ++---
.../AliasDetailRoute/AliasNotesForm.tsx | 47 ++++++++++++++++++-
src/server-types.ts | 1 +
5 files changed, 75 insertions(+), 9 deletions(-)
diff --git a/public/locales/de-DE/translation.json b/public/locales/de-DE/translation.json
index 1f431b7..ab1b27c 100644
--- a/public/locales/de-DE/translation.json
+++ b/public/locales/de-DE/translation.json
@@ -164,6 +164,18 @@
"label": "Erstellungsdatum",
"empty": "Nicht verfügbar"
},
+ "creationContext": {
+ "label": "Kontext",
+ "web": {
+ "label": "Auf dieser Instanz erstellt"
+ },
+ "extension": {
+ "label": "In der Erweiterung erstellt"
+ }
+ },
+ "createdOn": {
+ "label": "Erstellt auf"
+ },
"personalNotes": {
"label": "Persönliche Notizen",
"empty": "-",
diff --git a/public/locales/en-US/translation.json b/public/locales/en-US/translation.json
index a1bcf18..cabe0cd 100644
--- a/public/locales/en-US/translation.json
+++ b/public/locales/en-US/translation.json
@@ -172,6 +172,18 @@
"label": "Created at",
"empty": "Unavailable"
},
+ "creationContext": {
+ "label": "Creation Context",
+ "web": {
+ "label": "Created on this instance"
+ },
+ "extension": {
+ "label": "Created in the extension"
+ }
+ },
+ "createdOn": {
+ "label": "Created on"
+ },
"personalNotes": {
"label": "Personal Notes",
"empty": "-",
diff --git a/src/components/SimpleOverlayInformation.tsx b/src/components/SimpleOverlayInformation.tsx
index 42d233d..762bdf4 100644
--- a/src/components/SimpleOverlayInformation.tsx
+++ b/src/components/SimpleOverlayInformation.tsx
@@ -1,7 +1,7 @@
import {ReactElement} from "react"
import {useTranslation} from "react-i18next"
-import {Grid, Typography} from "@mui/material"
+import {Box, Grid, Typography} from "@mui/material"
export interface SimpleOverlayInformationProps {
label: string
@@ -25,12 +25,10 @@ export default function SimpleOverlayInformation({
{label}
-
- {icon && {icon}}
-
- {children || {emptyTextValue}}
-
-
+
+ {icon}
+ {children || {emptyTextValue}}
+
)
diff --git a/src/route-widgets/AliasDetailRoute/AliasNotesForm.tsx b/src/route-widgets/AliasDetailRoute/AliasNotesForm.tsx
index 712c541..f579723 100644
--- a/src/route-widgets/AliasDetailRoute/AliasNotesForm.tsx
+++ b/src/route-widgets/AliasDetailRoute/AliasNotesForm.tsx
@@ -2,8 +2,8 @@ import * as yup from "yup"
import {TiDelete} from "react-icons/ti"
import {AxiosError} from "axios"
import {ReactElement, useContext, useMemo, useState} from "react"
-import {MdCheckCircle, MdEditCalendar} from "react-icons/md"
-import {RiStickyNoteFill} from "react-icons/ri"
+import {MdCheckCircle, MdEditCalendar, MdExtension} from "react-icons/md"
+import {RiGlobalLine, RiLinkM, RiStickyNoteFill} from "react-icons/ri"
import {FieldArray, FormikProvider, useFormik} from "formik"
import {FaPen} from "react-icons/fa"
import {useTranslation} from "react-i18next"
@@ -16,6 +16,7 @@ import {
Grid,
IconButton,
InputAdornment,
+ Link,
List,
ListItem,
ListItemIcon,
@@ -51,6 +52,11 @@ interface Form {
detail?: string
}
+const CREATION_CONTEXT_ICON_MAP: Record = {
+ web: ,
+ extension: ,
+}
+
export default function AliasNotesForm({id, notes, queryKey}: AliasNotesFormProps): ReactElement {
const {t} = useTranslation()
const {showError, showSuccess} = useErrorSuccessSnacks()
@@ -215,6 +221,43 @@ export default function AliasNotesForm({id, notes, queryKey}: AliasNotesFormProp
)}
+ {notes.data.creationContext && (
+
+
+
+ {t(
+ `routes.AliasDetailRoute.sections.notes.form.creationContext.${notes.data.creationContext}.label`,
+ )}
+
+
+
+ )}
+ {notes.data.createdOn && (
+
+ }
+ label={t(
+ "routes.AliasDetailRoute.sections.notes.form.createdOn.label",
+ )}
+ >
+
+
+ {notes.data.createdOn}
+
+
+
+
+ )}