Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Instructions toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbo committed Oct 28, 2024
1 parent 785ff77 commit f3ccaa0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions domains/grid/components/AddWidgetBasic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const {
handleFieldChange,
handleFormErrors,
} = useForm(schema, (await schema?.safeParseAsync(props.properties))?.data)
const isInstructionsVisible = ref(false)
const handleSave = async () => {
if (!canSubmit.value) {
Expand Down Expand Up @@ -69,6 +70,12 @@ const handleBackToSelection = () => {
},
})
}
const widgetInstructions = computed(() => {
return formatMessage(`add_widget_${props.type.toLowerCase()}_instructions`)
})
const hasInstructions = computed(() => widgetInstructions.value !== '-')
</script>

<template>
Expand All @@ -94,6 +101,28 @@ const handleBackToSelection = () => {
`${isEdit ? 'edit' : 'add'}_widget_${type.toLowerCase()}_description`
)
}}

<!-- Instructions -->
<template v-if="hasInstructions">
<span
v-if="isInstructionsVisible"
class="cursor-pointer text-blue-60 underline hover:text-blue-50"
@click="isInstructionsVisible = !isInstructionsVisible"
>Hide instructions</span
>
<span
v-else
class="cursor-pointer text-blue-60 underline hover:text-blue-50"
@click="isInstructionsVisible = !isInstructionsVisible"
>Show instructions</span
>
<div
v-if="isInstructionsVisible"
class="mt-4 animate-fade-in whitespace-pre-line font-600 break-word"
>
{{ widgetInstructions }}
</div>
</template>
</div>

<!-- Content -->
Expand Down
1 change: 1 addition & 0 deletions translations/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
"add_widget_instagram_description": "Allows to embed Instagram post.",
"token_asset_type_other": "OTHER",
"profile_tab_tokens": "Tokens",
"add_widget_image_instructions": "1. Visit your Spotify app/mobile\n2. Visit your Spotify app/mobile\n3. Go to a artist or playlist",
"modal_mobile_search_placeholder": "Search by title",
"widget_type_instagram": "Instagram",
"add_missing_assets_page_title": "Check missing asset",
Expand Down

0 comments on commit f3ccaa0

Please sign in to comment.