From f6a933b666357b8e2d4dc0e0c0b42d6857a9f4af Mon Sep 17 00:00:00 2001 From: GreenAsJade Date: Sat, 13 Jul 2024 19:45:16 +0930 Subject: [PATCH 1/2] Support a placeholder in Autotranslate --- .../AutoTranslate/AutoTranslate.styl | 7 +++++ .../AutoTranslate/AutoTranslate.tsx | 27 ++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/components/AutoTranslate/AutoTranslate.styl b/src/components/AutoTranslate/AutoTranslate.styl index 48ad9c8b82..6d9f736311 100644 --- a/src/components/AutoTranslate/AutoTranslate.styl +++ b/src/components/AutoTranslate/AutoTranslate.styl @@ -11,4 +11,11 @@ text-align: right; themed background-color shade5 } + .placeholder { + themed color fg; + font-style: italic; + font-size: smaller; + themed background-color bg + padding: 0.5em; + } } diff --git a/src/components/AutoTranslate/AutoTranslate.tsx b/src/components/AutoTranslate/AutoTranslate.tsx index d8ca43ec56..fec6b1ea77 100644 --- a/src/components/AutoTranslate/AutoTranslate.tsx +++ b/src/components/AutoTranslate/AutoTranslate.tsx @@ -25,6 +25,7 @@ interface AutoTranslateProps { className?: string; markdown?: boolean; source_language?: string; + placeholder?: string; } interface Translation { @@ -39,7 +40,15 @@ export function AutoTranslate({ source_language, className, markdown, + placeholder, }: AutoTranslateProps): JSX.Element | null { + let showing_placeholder = false; + + if (!source && placeholder) { + showing_placeholder = true; + source = placeholder; + markdown = false; // this is needed to ensure placeholder is formatted correctly + } const need_translation = source !== "" && (!source_language || source_language.toLowerCase() !== current_language); @@ -76,14 +85,16 @@ export function AutoTranslate({ // If we have a translation, then we show it in the primary formatting, followed by the original. // If we don't have a translation, then we show the original in primary formatting. return ( -
+
{show_translation ? ( <> - {markdown ? ( - - ) : ( - translation.target_text - )} +
+ {markdown ? ( + + ) : ( + translation.target_text + )} +
{pgettext( "This label is placed on the original text of something that has been translated", @@ -97,7 +108,9 @@ export function AutoTranslate({ ) : markdown ? ( ) : ( - source +
+ {source} +
)}
); From 1ef2e0a73ae3080cbdfc7c9a3939e78b6da86f48 Mon Sep 17 00:00:00 2001 From: GreenAsJade Date: Sat, 13 Jul 2024 19:45:45 +0930 Subject: [PATCH 2/2] Don't let a user make a second report on a given game. --- .../IncidentReportCard.tsx | 60 ++++++++++--------- .../IncidentReportTracker.tsx | 9 ++- src/components/Report/Report.tsx | 19 ++++-- src/lib/data_schema.ts | 2 + src/lib/report_manager.tsx | 10 +++- 5 files changed, 65 insertions(+), 35 deletions(-) diff --git a/src/components/IncidentReportTracker/IncidentReportCard.tsx b/src/components/IncidentReportTracker/IncidentReportCard.tsx index 80ccfaf5e4..c3e2d6a010 100644 --- a/src/components/IncidentReportTracker/IncidentReportCard.tsx +++ b/src/components/IncidentReportTracker/IncidentReportCard.tsx @@ -103,7 +103,11 @@ export function IncidentReportCard({
{isEditing ? (
-