fix(ui): Modal toggles
This commit is contained in:
parent
42805171fe
commit
4681e23a1e
|
@ -8,6 +8,13 @@ import { useStore } from '~/store'
|
||||||
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
|
import Layout from '~/components/ui/Layout.vue'
|
||||||
|
import Button from '~/components/ui/Button.vue'
|
||||||
|
import Input from '~/components/ui/Input.vue'
|
||||||
|
import Alert from '~/components/ui/Alert.vue'
|
||||||
|
import Tabs from '~/components/ui/Tabs.vue'
|
||||||
|
import Tab from '~/components/ui/Tab.vue'
|
||||||
|
|
||||||
import updateQueryString from '~/composables/updateQueryString'
|
import updateQueryString from '~/composables/updateQueryString'
|
||||||
import useLogger from '~/composables/useLogger'
|
import useLogger from '~/composables/useLogger'
|
||||||
|
|
||||||
|
@ -165,40 +172,52 @@ watch(() => props.initialId, () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<Tabs
|
||||||
v-if="type === 'both'"
|
v-if="type === 'both'"
|
||||||
class="two ui buttons"
|
class="two ui buttons"
|
||||||
>
|
>
|
||||||
<button
|
<Tab
|
||||||
class="ui left floated labeled icon button"
|
icon="bi-feed"
|
||||||
|
title="t('components.RemoteSearchForm.button.rss')"
|
||||||
@click.prevent="type = 'rss'"
|
@click.prevent="type = 'rss'"
|
||||||
>
|
>
|
||||||
<i class="feed icon" />
|
{{ t('components.RemoteSearchForm.description.rss') }}
|
||||||
{{ t('components.RemoteSearchForm.button.rss') }}
|
<Input
|
||||||
</button>
|
id="object-id"
|
||||||
<div class="or" />
|
v-model="id"
|
||||||
<button
|
type="text"
|
||||||
class="ui right floated right labeled icon button"
|
name="object-id"
|
||||||
|
:placeholder="labels.fieldPlaceholder"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</Tab>
|
||||||
|
<Tab
|
||||||
|
icon="bi-globe"
|
||||||
|
title="t('components.RemoteSearchForm.button.fediverse')"
|
||||||
@click.prevent="type = 'artists'"
|
@click.prevent="type = 'artists'"
|
||||||
>
|
>
|
||||||
<i class="globe icon" />
|
{{ t('components.RemoteSearchForm.description.fediverse') }}
|
||||||
{{ t('components.RemoteSearchForm.button.fediverse') }}
|
<Input
|
||||||
</button>
|
id="object-id"
|
||||||
</div>
|
v-model="id"
|
||||||
|
type="text"
|
||||||
|
name="object-id"
|
||||||
|
:placeholder="labels.fieldPlaceholder"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<form
|
<Layout form
|
||||||
id="remote-search"
|
id="remote-search"
|
||||||
:class="['ui', {loading: isLoading}, 'form']"
|
:class="['ui', {loading: isLoading}, 'form']"
|
||||||
@submit.stop.prevent="submit"
|
@submit.stop.prevent="submit"
|
||||||
>
|
>
|
||||||
<div
|
<Alert red
|
||||||
v-if="errors.length > 0"
|
v-if="errors.length > 0"
|
||||||
role="alert"
|
role="alert"
|
||||||
class="ui negative message"
|
title="t('components.RemoteSearchForm.header.fetchFailed')"
|
||||||
>
|
>
|
||||||
<h3 class="header">
|
|
||||||
{{ t('components.RemoteSearchForm.header.fetchFailed') }}
|
|
||||||
</h3>
|
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li
|
<li
|
||||||
v-for="(error, key) in errors"
|
v-for="(error, key) in errors"
|
||||||
|
@ -207,43 +226,21 @@ watch(() => props.initialId, () => {
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</Alert>
|
||||||
<div class="ui required field">
|
<Button
|
||||||
<label for="object-id">
|
|
||||||
{{ labels.fieldLabel }}
|
|
||||||
</label>
|
|
||||||
<p v-if="type === 'rss'">
|
|
||||||
{{ t('components.RemoteSearchForm.description.rss') }}
|
|
||||||
</p>
|
|
||||||
<p v-else-if="type === 'artists'">
|
|
||||||
{{ t('components.RemoteSearchForm.description.fediverse') }}
|
|
||||||
</p>
|
|
||||||
<input
|
|
||||||
id="object-id"
|
|
||||||
v-model="id"
|
|
||||||
type="text"
|
|
||||||
name="object-id"
|
|
||||||
:placeholder="labels.fieldPlaceholder"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
v-if="showSubmit"
|
v-if="showSubmit"
|
||||||
|
primary
|
||||||
type="submit"
|
type="submit"
|
||||||
:class="['ui', 'primary', {loading: isLoading}, 'button']"
|
:class="{loading: isLoading}"
|
||||||
:disabled="isLoading || !id || id.length === 0"
|
:disabled="isLoading || !id || id.length === 0"
|
||||||
>
|
>
|
||||||
{{ t('components.RemoteSearchForm.button.search') }}
|
{{ t('components.RemoteSearchForm.button.search') }}
|
||||||
</button>
|
</Button>
|
||||||
</form>
|
</Layout>
|
||||||
<div
|
<Alert
|
||||||
v-if="!isLoading && obj?.status === 'finished' && !redirectRoute"
|
v-if="!isLoading && obj?.status === 'finished' && !redirectRoute"
|
||||||
role="alert"
|
|
||||||
class="ui warning message"
|
|
||||||
>
|
>
|
||||||
<p>
|
|
||||||
{{ t('components.RemoteSearchForm.warning.unsupported') }}
|
{{ t('components.RemoteSearchForm.warning.unsupported') }}
|
||||||
</p>
|
</Alert>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -218,7 +218,8 @@ const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value]
|
||||||
solid
|
solid
|
||||||
small
|
small
|
||||||
primary
|
primary
|
||||||
:to="{name: 'content.index'}"
|
@click="store.commit('ui/toggleModal', 'upload')"
|
||||||
|
:aria-pressed="store.state.ui.modalsOpen.has('upload') || undefine"
|
||||||
>
|
>
|
||||||
<template #image>
|
<template #image>
|
||||||
<i class="bi bi-upload" style="font-size: 100px; position: relative; top: 50px;" />
|
<i class="bi bi-upload" style="font-size: 100px; position: relative; top: 50px;" />
|
||||||
|
|
|
@ -230,7 +230,8 @@ const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value]
|
||||||
solid
|
solid
|
||||||
small
|
small
|
||||||
primary
|
primary
|
||||||
:to="{name: 'content.index'}"
|
@click="store.commit('ui/toggleModal', 'upload')"
|
||||||
|
:aria-pressed="store.state.ui.modalsOpen.has('upload') || undefine"
|
||||||
>
|
>
|
||||||
<template #image>
|
<template #image>
|
||||||
<i class="bi bi-upload" style="font-size: 100px; position: relative; top: 50px;" />
|
<i class="bi bi-upload" style="font-size: 100px; position: relative; top: 50px;" />
|
||||||
|
|
|
@ -16,6 +16,7 @@ import axios from 'axios'
|
||||||
import TagsSelector from '~/components/library/TagsSelector.vue'
|
import TagsSelector from '~/components/library/TagsSelector.vue'
|
||||||
import RemoteSearchForm from '~/components/RemoteSearchForm.vue'
|
import RemoteSearchForm from '~/components/RemoteSearchForm.vue'
|
||||||
import Modal from '~/components/ui/Modal.vue'
|
import Modal from '~/components/ui/Modal.vue'
|
||||||
|
import Card from '~/components/ui/Card.vue'
|
||||||
import ArtistCard from '~/components/artist/Card.vue'
|
import ArtistCard from '~/components/artist/Card.vue'
|
||||||
import Pagination from '~/components/ui/Pagination.vue'
|
import Pagination from '~/components/ui/Pagination.vue'
|
||||||
import Layout from '~/components/ui/Layout.vue'
|
import Layout from '~/components/ui/Layout.vue'
|
||||||
|
@ -129,6 +130,17 @@ const labels = computed(() => ({
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value].sort((a, b) => a - b)))
|
const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value].sort((a, b) => a - b)))
|
||||||
|
|
||||||
|
const modalName = 'subscribe'
|
||||||
|
|
||||||
|
const isOpen = computed({
|
||||||
|
get() {
|
||||||
|
return store.state.ui.modalsOpen.has(modalName);
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
store.commit('ui/setModal', [modalName, value]);
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -213,22 +225,32 @@ const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value]
|
||||||
{{ t('components.library.Podcasts.empty.noResults') }}
|
{{ t('components.library.Podcasts.empty.noResults') }}
|
||||||
</Alert>
|
</Alert>
|
||||||
<Layout flex>
|
<Layout flex>
|
||||||
<Button
|
<Card
|
||||||
v-if="store.state.auth.authenticated"
|
v-if="store.state.auth.authenticated"
|
||||||
icon="bi-plus"
|
:title="t('components.library.Podcasts.button.feed')"
|
||||||
|
solid
|
||||||
|
small
|
||||||
primary
|
primary
|
||||||
@click.stop.prevent="showSubscribeModal = true"
|
@click="store.commit('ui/toggleModal', 'subscribe')"
|
||||||
|
:aria-pressed="store.state.ui.modalsOpen.has('subscribe') || undefine"
|
||||||
>
|
>
|
||||||
{{ t('components.library.Podcasts.button.feed') }}
|
<template #image>
|
||||||
</Button>
|
<i class="bi bi-plus" style="font-size: 100px; position: relative; top: 50px;" />
|
||||||
<Button
|
</template>
|
||||||
primary
|
</Card>
|
||||||
|
<Card
|
||||||
v-if="store.state.auth.authenticated"
|
v-if="store.state.auth.authenticated"
|
||||||
icon="bi-upload"
|
:title="t('components.library.Podcasts.button.channel')"
|
||||||
:to="{name: 'content.index'}"
|
solid
|
||||||
|
small
|
||||||
|
primary
|
||||||
|
@click="store.commit('ui/toggleModal', 'upload')"
|
||||||
|
:aria-pressed="store.state.ui.modalsOpen.has('upload') || undefine"
|
||||||
>
|
>
|
||||||
{{ t('components.library.Podcasts.button.channel') }}
|
<template #image>
|
||||||
</Button>
|
<i class="bi bi-upload" style="font-size: 100px; position: relative; top: 50px;" />
|
||||||
|
</template>
|
||||||
|
</Card>
|
||||||
</Layout>
|
</Layout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<Spacer grow />
|
<Spacer grow />
|
||||||
|
@ -238,8 +260,8 @@ const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value]
|
||||||
:pages="Math.ceil((result?.results.length || 0)/paginateBy)"
|
:pages="Math.ceil((result?.results.length || 0)/paginateBy)"
|
||||||
/>
|
/>
|
||||||
<Modal
|
<Modal
|
||||||
v-model:show="showSubscribeModal"
|
v-model="isOpen"
|
||||||
title="t('components.library.Podcasts.modal.subscription.header')"
|
:title="t('components.library.Podcasts.modal.subscription.header')"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
ref="modalContent"
|
ref="modalContent"
|
||||||
|
@ -250,21 +272,25 @@ const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value]
|
||||||
:show-submit="false"
|
:show-submit="false"
|
||||||
:standalone="false"
|
:standalone="false"
|
||||||
:redirect="true"
|
:redirect="true"
|
||||||
@subscribed="showSubscribeModal = false; fetchData()"
|
@subscribed="isOpen = false; fetchData()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<template #actions>
|
||||||
<Button color="secondary">
|
<Button
|
||||||
|
secondary
|
||||||
|
@click="isOpen = false"
|
||||||
|
>
|
||||||
{{ t('components.library.Podcasts.button.cancel') }}
|
{{ t('components.library.Podcasts.button.cancel') }}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
primary
|
||||||
form="remote-search"
|
form="remote-search"
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
<i class="bookmark icon" />
|
<i class="bookmark icon" />
|
||||||
{{ t('components.library.Podcasts.button.subscribe') }}
|
{{ t('components.library.Podcasts.button.subscribe') }}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</template>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
|
@ -67,7 +67,7 @@ const logoUrl = computed(() => store.state.auth.authenticated ? 'library.index'
|
||||||
:class="[$style.button]"
|
:class="[$style.button]"
|
||||||
ghost
|
ghost
|
||||||
@click="store.commit('ui/toggleModal', 'upload')"
|
@click="store.commit('ui/toggleModal', 'upload')"
|
||||||
:aria-pressed="store.state.ui.modalsOpen.has('languages') || undefined"
|
:aria-pressed="store.state.ui.modalsOpen.has('upload') || undefined"
|
||||||
>
|
>
|
||||||
<Transition>
|
<Transition>
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in New Issue