diff --git a/src/components/Index.vue b/src/components/Index.vue index c20c349..aa64c26 100644 --- a/src/components/Index.vue +++ b/src/components/Index.vue @@ -36,7 +36,6 @@ function onSubmit() { diff --git a/src/components/card-templates/LayoutDoubleFaced.vue b/src/components/card-templates/LayoutDoubleFaced.vue index 4ad0c14..a93a6a9 100644 --- a/src/components/card-templates/LayoutDoubleFaced.vue +++ b/src/components/card-templates/LayoutDoubleFaced.vue @@ -3,6 +3,7 @@ import { defineProps } from 'vue' import { ScryfallCard } from '../../scryfall' import { cardInnerTemplate } from './index' import CardError from './CardError.vue' +import { resultsConfig } from '../results-config'; const props = defineProps<{ card: ScryfallCard @@ -16,15 +17,30 @@ const error = props.card.card_faces?.length != 2; diff --git a/src/components/results-config.ts b/src/components/results-config.ts new file mode 100644 index 0000000..7d5337e --- /dev/null +++ b/src/components/results-config.ts @@ -0,0 +1,41 @@ +import { reactive, watch } from 'vue' + +type ResultsConfig = { + editableContent: boolean, + displayReminderText: boolean, + doubleFacedOnTwoCards: boolean +} + +const defaultResultsConfig: ResultsConfig = { + editableContent: false, + displayReminderText: true, + doubleFacedOnTwoCards: true +} + +export const resultsConfig = reactive(defaultResultsConfig) + +// Load from local storage on start +loadConfigFromLocalStorage() + +// Store in local storage when config changes +watch(resultsConfig, config => { + localStorage.setItem('resultsConfig', JSON.stringify(config)) +}) + +function loadConfigFromLocalStorage() { + const storedRawConfig = localStorage.getItem('resultsConfig') + + if (storedRawConfig) { + const storedConfig = JSON.parse(storedRawConfig) + + if (storedConfig.editableContent !== undefined) { + resultsConfig.editableContent = storedConfig.editableContent + } + if (storedConfig.displayReminderText !== undefined) { + resultsConfig.displayReminderText = storedConfig.displayReminderText + } + if (storedConfig.doubleFacedOnTwoCards !== undefined) { + resultsConfig.doubleFacedOnTwoCards = storedConfig.doubleFacedOnTwoCards + } + } +} diff --git a/src/style.css b/src/style.css index e69de29..5db250e 100644 --- a/src/style.css +++ b/src/style.css @@ -0,0 +1,3 @@ +* { + font-family: 'Open Sans', sans-serif; +}