Skip to content

Commit

Permalink
fix: make dialogs responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
henrychoy committed Jan 8, 2025
1 parent 21cd290 commit 1614e0e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 54 deletions.
5 changes: 5 additions & 0 deletions src/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
const $q = useQuasar()
const isExtraSmall = computed(() => {
return $q.screen.xs
})
const isMobile = computed(() => {
return $q.screen.sm || $q.screen.xs
})
Expand All @@ -50,6 +54,7 @@
provide('isMobile', isMobile)
provide('isMedium', isMedium)
provide('isExtraSmall', isExtraSmall)
watch(route, (to) => {
// on every route change, close snapshot drawer if open
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ h2 {

.field-label {
width: 100px;
font-size: 1rem;
font-size: .6em;
color: black;
}

Expand Down
6 changes: 4 additions & 2 deletions src/frontend/src/dialogs/DialogComponent.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<q-dialog v-model="showDialog" aria-labelledby="modalTitle" :persistent="persistent">
<q-card flat style="min-width: 500px; max-width: 80%;">
<q-card flat :style="{ 'min-width': isMedium ? '50%' : '30%' }">
<q-form @submit="$emit('emitSubmit')">
<q-card-section class="bg-primary text-white q-mb-md">
<div class="text-h6 row justify-between">
Expand Down Expand Up @@ -37,11 +37,13 @@
</template>

<script setup>
import { ref } from 'vue'
import { inject } from 'vue'
const showDialog = defineModel('showDialog')
defineEmits(['emitSubmit', 'emitCancel', 'emitSaveDraft'])
const props = defineProps(['hideDraftBtn', 'persistent', 'showHistoryToggle', 'disableConfirm'])
const history = defineModel('history')
const isMedium = inject('isMedium')
</script>
99 changes: 48 additions & 51 deletions src/frontend/src/dialogs/QueueDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,62 +16,57 @@
<div class="row">
<!-- this is the form col -->
<div
class="col-auto"
style="width: 500px;"
:class="`${isExtraSmall ? 'col-12 q-mb-md' : 'col'}`"
:style="{
pointerEvents: history ? 'none' : 'auto',
opacity: history ? .65 : 1,
cursor: history ? 'not-allowed' : 'default'
}"
ref="formCol"
>
<div class="row items-center">
<label class="col-3 q-mb-lg" id="queueName">
Queue Name:
</label>
<q-input
class="col q-mb-xs"
outlined
dense
v-model.trim="name"
autofocus
:rules="[requiredRule]"
aria-labelledby="queueName"
aria-required="true"
/>
</div>
<div class="row items-center q-mb-xs">
<label class="col-3 q-mb-lg" id="pluginGroup">
Group:
</label>
<q-select
class="col"
outlined
v-model="group"
:options="store.groups"
option-label="name"
option-value="id"
emit-value
map-options
dense
:rules="[requiredRule]"
aria-labelledby="pluginGroup"
aria-required="true"
/>
</div>
<div class="row items-center">
<label class="col-3" id="description">
Description:
</label>
<q-input
class="col"
v-model.trim="description"
outlined
type="textarea"
aria-labelledby="description"
/>
</div>
<!-- <q-inner-loading :showing="history" size="0px" /> -->
<q-input
class="q-mb-xs"
outlined
dense
v-model.trim="name"
autofocus
:rules="[requiredRule]"
id="queueName"
aria-required="true"
>
<template #before>
<label for="queueName" class="field-label">Queue Name:</label>
</template>
</q-input>
<q-select
class="q-mb-xs"
outlined
v-model="group"
:options="store.groups"
option-label="name"
option-value="id"
emit-value
map-options
dense
:rules="[requiredRule]"
id="pluginGroup"
aria-required="true"
>
<template #before>
<label for="pluginGroup" class="field-label">Group:</label>
</template>
</q-select>
<q-input
v-model.trim="description"
outlined
type="textarea"
id="description"
dense
>
<template #before>
<label for="description" class="field-label">Description:</label>
</template>
</q-input>
</div>
<!-- this is the history col -->
<SnapshotList
Expand All @@ -80,20 +75,22 @@
type="queues"
:id="props.editQueue.id"
:maxHeight="formCol?.clientHeight"
class="q-ml-md"
:class="`${isExtraSmall ? 'col-12' : 'col-sm-auto q-ml-md'}`"
/>
</div>
</DialogComponent>
</template>

<script setup>
import { ref, watch } from 'vue'
import { ref, watch, inject } from 'vue'
import DialogComponent from './DialogComponent.vue'
import { useLoginStore } from '@/stores/LoginStore.ts'
import SnapshotList from '../components/SnapshotList.vue'
const store = useLoginStore()
const isExtraSmall = inject('isExtraSmall')
const props = defineProps(['editQueue'])
const emit = defineEmits(['addQueue', 'updateQueue', 'saveDraft'])
Expand Down

0 comments on commit 1614e0e

Please sign in to comment.