Skip to content

Commit

Permalink
Added default message to sightGuidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
dlymonkai committed Aug 7, 2024
1 parent 454a985 commit 1c72718
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export interface SightGuidelineProps
* The id of the sight.
*/
sightId: string;
/**
* Display a default message if no sightGuideline is found.
*
* @default false
*/
enableDefaultMessage?: boolean;
}

/**
Expand All @@ -25,16 +31,21 @@ export function SightGuideline({
sightGuidelines,
enableSightGuidelines,
enableAddDamage,
enableDefaultMessage = false,
}: SightGuidelineProps) {
const [showGuideline, setShowGuideline] = useState(true);
const primaryColor = usePhotoCaptureHUDButtonBackground();
const { i18n } = useTranslation();
const { i18n, t } = useTranslation();

const style = enableAddDamage ? styles['container'] : styles['containerWide'];

const guidelineFound = sightGuidelines?.find((value) => value.sightIds.includes(sightId));

const guideline = guidelineFound ? guidelineFound[getLanguage(i18n.language)] : undefined;
const defaultMessage = enableDefaultMessage
? t('photo.hud.guidelines.defaultGuideline')
: undefined;

const guideline = guidelineFound ? guidelineFound[getLanguage(i18n.language)] : defaultMessage;

useEffect(() => setShowGuideline(true), [sightId]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const styles: Styles = {
display: 'flex',
flexDirection: 'column',
gap: '3px',
alignItems: 'center',
},
buttonsContainer: {
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function PhotoCaptureHUDTutorial({
sightGuidelines={sightGuidelines}
enableSightGuidelines={currentTutorialStep === TutorialSteps.GUIDELINE}
enableAddDamage={true}
enableDefaultMessage={true}
/>
<Button
style={{ ...styles['closeButton'], ...getButtonStyle(allowSkipTutorial) }}
Expand Down
3 changes: 3 additions & 0 deletions packages/inspection-capture-web/src/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"cancel": "Abbrechen",
"confirm": "Ja"
},
"guidelines": {
"defaultGuideline": "Blickwinkelanzeigen für Bilder können hier angezeigt werden."
},
"tutorial": {
"welcome": "Willkommen zu Ihrer ersten Inspektion!",
"title": "So verwenden Sie es",
Expand Down
3 changes: 3 additions & 0 deletions packages/inspection-capture-web/src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"cancel": "Cancel",
"confirm": "Yes"
},
"guidelines": {
"defaultGuideline": "Picture view point indications can be displayed here."
},
"tutorial": {
"welcome": "Welcome to your first inspection!",
"title": "How to use it",
Expand Down
3 changes: 3 additions & 0 deletions packages/inspection-capture-web/src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"cancel": "Annuler",
"confirm": "Oui"
},
"guidelines": {
"defaultGuideline": "Les indications de point de vue de l'image peuvent être affichées ici."
},
"tutorial": {
"welcome": "Bienvenue à votre première inspection!",
"title": "Comment l'utiliser",
Expand Down
3 changes: 3 additions & 0 deletions packages/inspection-capture-web/src/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"cancel": "Annuleren",
"confirm": "Ja"
},
"guidelines": {
"defaultGuideline": "Afbeeldingsstandpuntaanwijzingen kunnen hier worden weergegeven."
},
"tutorial": {
"welcome": "Welkom bij uw eerste inspectie!",
"title": "Hoe te gebruiken",
Expand Down

0 comments on commit 1c72718

Please sign in to comment.