Skip to content

Commit

Permalink
feat(embed-wizard): implement wizard menu
Browse files Browse the repository at this point in the history
  • Loading branch information
KatvonRivia committed Aug 9, 2023
1 parent 221f493 commit ba920c5
Show file tree
Hide file tree
Showing 27 changed files with 488 additions and 75 deletions.
8 changes: 8 additions & 0 deletions i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"analytics": "Analytics",
"download": "Anwendung herunterladen",
"share": "Teile mit der Welt",
"embed": "Einbetten",
"embedDescription": "Konfigurieren Sie die Klima aus dem Weltraum Anwendung, um sie in die Anwendung einzubetten. Ausgewählte Datenebene, ausgewählte Geschichte und Globusposition werden standardmäßig gespeichert",
"copyLink": "Link kopieren",
"export": "Daten exportieren",
"info": "Weitere Informationen",
Expand All @@ -66,6 +68,12 @@
"tracking.no": "Nicht tracken",
"feedback": "Feedback",
"provideFeedback": "Feedback geben",
"embedWizard": "Einbettungs-Assistent",
"app": "App",
"embedCode": "Einbettungscode",
"embedLink": "Einbettungslink",
"copyEmbedCode": "Einbettungscode kopieren",
"copyEmbedLink": "Einbettungslink kopieren",
"tags.sea-surface-temperature": "Meeresoberflächentemperatur",
"tags.sea-ice": "Meereis",
"tags.ocean-colour": "Ozean Farbe",
Expand Down
8 changes: 8 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"analytics": "Analytics",
"download": "Download App",
"share": "Share with the world",
"embed": "Embed",
"embedDescription": "Configure the climate from space Application to embed it in the application. Selected data layer, selected story and globe position are stored by default",
"copyLink": "Copy Link",
"export": "Export Data",
"info": "More Information",
Expand All @@ -66,6 +68,12 @@
"tracking.no": "Don't track",
"feedback": "Feedback",
"provideFeedback": "Provide feedback",
"embedWizard": "Embedding Wizard",
"app": "App",
"embedCode": "Embedding Code",
"embedLink": "Embedding Link",
"copyEmbedCode": "Copy embed code",
"copyEmbedLink": "Copy embed link",
"tags.sea-surface-temperature": "Sea Surface Temperature",
"tags.sea-ice": "Sea Ice",
"tags.ocean-colour": "Ocean Colour",
Expand Down
8 changes: 8 additions & 0 deletions i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"analytics": "Analytics",
"download": "Descargar app",
"share": "Compartir con el mundo",
"embed": "Insertar",
"embedDescription": "Configurar el clima desde el espacio Aplicación para incrustarlo en la aplicación. La capa de datos seleccionada, la historia seleccionada y la posición del globo se almacenan por defecto",
"copyLink": "Copiar vínculo",
"export": "Exportar datos",
"info": "Más información",
Expand All @@ -66,6 +68,12 @@
"tracking.no": "No Rastrear",
"feedback": "Feedback",
"provideFeedback": "Danos tu opinión",
"embedWizard": "Asistente de incrustación",
"app": "App",
"embedCode": "Código de incrustación",
"embedLink": "Enlace de incrustación",
"copyEmbedCode": "Copiar código de incrustación",
"copyEmbedLink": "Copiar enlace embed",
"tags.sea-surface-temperature": "Temperatura de la superficie del mar",
"tags.sea-ice": "Hielo marino",
"tags.ocean-colour": "Color del océano",
Expand Down
8 changes: 8 additions & 0 deletions i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"download": "Download l'application",
"share": "Partager avec le monde",
"copyLink": "Copier lien",
"embed": "Embarquer",
"embedDescription": "Configurez l'application Climat de l'espace pour l'intégrer dans l'application. La couche de données sélectionnée, l'histoire sélectionnée et la position du globe sont stockées par défaut",
"export": "Exporter les données",
"info": "Plus d'informations",
"about": "À propos du projet",
Expand All @@ -66,6 +68,12 @@
"tracking.no": "Ne pas suivre",
"feedback": "Feedback",
"provideFeedback": "Donner un feedback",
"embedWizard": "Assistant d'intégration",
"app": "App",
"embedCode": "Code d'intégration",
"embedLink": "Lien d'intégration",
"copyEmbedCode": "Copier le code d'intégration",
"copyEmbedLink": "Copier le lien d'intégration",
"tags.sea-surface-temperature": "Température de surface de la mer",
"tags.sea-ice": "Glace de mer",
"tags.ocean-colour": "Couleur des océans",
Expand Down
8 changes: 8 additions & 0 deletions i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"analytics": "Analytics",
"download": "App downloaden",
"share": "Deel met de wereld",
"embed": "Embed",
"embedDescription": "Configureer het klimaat vanuit de ruimte Toepassing om het in te sluiten in de toepassing. Geselecteerde gegevenslaag, geselecteerd verhaal en wereldbolpositie worden standaard opgeslagen",
"copyLink": "Link kopiëren",
"export": "Data exporteren",
"info": "Meer informatie",
Expand All @@ -66,6 +68,12 @@
"tracking.no": "Niet volgen",
"feedback": "Feedback",
"provideFeedback": "Feedback geven",
"embedWizard": "Wizard insluiten",
"app": "App",
"embedCode": "Code insluiten",
"embedLink": "Link insluiten",
"copyEmbedCode": "Kopieer embedcode",
"copyEmbedLink": "Kopieer embed link",
"tags.sea-surface-temperature": "Zeewateroppervlaktetemperatuur",
"tags.sea-ice": "Zee-ijs",
"tags.ocean-colour": "Oceaankleur",
Expand Down
19 changes: 19 additions & 0 deletions src/scripts/actions/set-app-element-embed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {AppElementsState} from '../types/embed-elements';

export const TOGGLE_APP_ELEMENTS = 'TOGGLE_APP_ELEMENTS';

export interface SetAppElementsAction {
type: typeof TOGGLE_APP_ELEMENTS;
appElements: AppElementsState;
}

export function setAppElementsAction(
appElements: AppElementsState
): SetAppElementsAction {
return {
type: TOGGLE_APP_ELEMENTS,
appElements
};
}

export default setAppElementsAction;
10 changes: 8 additions & 2 deletions src/scripts/components/main/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import translations from '../../../i18n';
import {useStoryMarkers} from '../../../hooks/use-story-markers';

import styles from './app.module.styl';
import {appElementsSelector} from '../../../selectors/embed/app-elements-embed';

// create matomo tracking instance
const matomoInstance = createInstance({
Expand All @@ -38,6 +39,7 @@ const matomoInstance = createInstance({
const TranslatedApp: FunctionComponent = () => {
const markers = useStoryMarkers();
const language = useSelector(languageSelector);
const {appElements} = useSelector(appElementsSelector);

const logo = (
<Link to="/about">
Expand All @@ -52,8 +54,12 @@ const TranslatedApp: FunctionComponent = () => {
<IntlProvider locale={language} messages={translations[language]}>
<Switch>
<Route path="/" exact>
{logo}
<DataViewer markers={markers} backgroundColor={'#10161A'} />
{appElements.logo !== false && logo}
<DataViewer
hideNavigation={appElements.globe_navigation === false}
markers={markers}
backgroundColor={'#10161A'}
/>
<Navigation />
<TimeSlider />
<DataSetInfo />
Expand Down
4 changes: 1 addition & 3 deletions src/scripts/components/main/button/button.module.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
font-size: 1rem
cursor: pointer
fill: $textWhite
gap: emCalc(7px)

svg
fill: $textWhite

svg + .label
padding-left: emCalc(7px)

&:hover
color: $main

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@require '../../../../variables.styl'

.checkboxList
display: flex
flex-direction: column
gap: emCalc(16px)

.checkboxListItem
display: flex
align-items: center
gap: emCalc(8px)

input[type='checkbox']
margin-left: 0
width: remCalc(20px)
height: remCalc(20px)
accent-color: $textWhite

label
color: $textDefault
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, {FunctionComponent} from 'react';

import styles from './embed-checkbox-list.module.styl';
import {ElementOptions} from '../../../types/embed-elements';

interface Props {
elementsChecked: ElementOptions;
handleChange: (elements: ElementOptions) => void;
}

const EmbedCheckboxList: FunctionComponent<Props> = ({
elementsChecked,
handleChange
}) => {
const convertToTitleCase = (inputString: string) =>
inputString
.split('_')
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');

return (
<div className={styles.checkboxList}>
{Object.keys(elementsChecked).map(element => (
<div className={styles.checkboxListItem} key={element}>
<input
type="checkbox"
name={element}
checked={elementsChecked[element] === true}
onChange={event => {
const checked = event.target.checked;

handleChange({
...elementsChecked,
[element]: checked
});
}}
/>
<label htmlFor={element}>{convertToTitleCase(element)}</label>
</div>
))}
</div>
);
};

export default EmbedCheckboxList;
40 changes: 40 additions & 0 deletions src/scripts/components/main/embed-result/embed-result.module.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@require '../../../../variables.styl'

.result
grid-area: 2 / 1 / 3 / 2

.resultItem
display: flex
flex-direction: column

.embedTextArea, .embedLinkTextArea
padding: emCalc(16px)
height: emCalc(171px)
border-radius: 4px
background: $black
color: $textDefault
font-weight: 400
font-style: normal
font-size: emCalc(16px)
font-family: Arial
line-height: emCalc(22px)
resize: none

.embedLinkTextArea
overflow-y: hidden
height: emCalc(20px)

.copyButton
flex-direction: row-reverse
align-self: flex-start
margin: emCalc(16px)
color: $main

> svg
fill: $main

.copyButton:hover
color: $textWhite

> svg
fill: $textWhite
49 changes: 49 additions & 0 deletions src/scripts/components/main/embed-result/embed-result.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React, {FunctionComponent} from 'react';
import {FormattedMessage} from 'react-intl';

import Button from '../button/button';
import {CopyTextIcon} from '../icons/copy-text-icon';

import styles from './embed-result.module.styl';

interface Props {
paramsString: string;
}
const EmbedResult: FunctionComponent<Props> = ({paramsString}) => (
<div className={styles.result}>
<div className={styles.resultItem}>
<h2>
<FormattedMessage id={'embedCode'} />
</h2>
<textarea
className={styles.embedTextArea}
value={paramsString}
readOnly
/>
<Button
className={styles.copyButton}
icon={CopyTextIcon}
label="copyEmbedCode"
/>
</div>

<div className={styles.resultItem}>
<h2>
<FormattedMessage id={'embedLink'} />
</h2>
<textarea
className={styles.embedLinkTextArea}
value={paramsString}
wrap="off"
readOnly
/>
<Button
className={styles.copyButton}
icon={CopyTextIcon}
label="copyEmbedLink"
/>
</div>
</div>
);

export default EmbedResult;
17 changes: 17 additions & 0 deletions src/scripts/components/main/embed-wizard/embed-wizard.module.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@require '../../../../variables.styl'

.embedWizard
display: grid
align-items: start
width: 60%
color: $textWhite
column-gap: emCalc(50px)
grid-template-columns: repeat(2, auto)
grid-template-rows: repeat(3, auto)
row-gap: emCalc(20px)

.header
grid-area: 1 / 1 / 2 / 3

.settings
display: grid
Loading

0 comments on commit ba920c5

Please sign in to comment.