Files
speckle-server/packages/frontend-2/components/projects/AddDialog.vue
T
andrewwallacespeckle 9f4b0c99da Dialog Consistency Task (#1852)
* Fixing up "Manage Project" & "New Project" Dialogs

* Dialog Updates

* Updates from tickets

* Remove sidepanel

* Remove max-height prop from Dialog component

* Updates to Profile Dialog

* Props for Buttons in Dialog. Attachment Dialog

* Remove margin to show issue with dialogs

* Update to stories

* Responsive updates

* Fix overflow on MoveTo

* Use Dialog header prop

* Dialog updates

* Responsive Changes

* Responsive fixes

* Small responsive change

* Fixes

* Type based declaration

* Last fixes

* Small darkmode fixes

* Updated type

* Update

* Updates from PR comments

* Fix storybook issues

* Updates from PR

* Updates from PR

* Changes from Agi

* Turntable mode Toggle

* Fix dialog shadows on scroll

* Fix invite autocomplete

* Changes from PR Comments

* Small styling updates

* Responsive views

* Adjust Danger zones

* Fix typo

* New Webhook Icon. Swap icon prop to slot.

* Adjust Icon weights

* FE2-TASK-27

* FE2-TASK-26

* FE2-TASK-28
2023-11-07 11:18:25 +00:00

89 lines
2.3 KiB
Vue

<template>
<LayoutDialog v-model:open="open" max-width="sm" :buttons="dialogButtons">
<template #header>Create new project</template>
<form class="flex flex-col text-foreground" @submit="onSubmit">
<div class="flex flex-col space-y-3 mb-6">
<FormTextInput
name="name"
label="Project name"
placeholder="Project name"
:rules="[isRequired, isStringOfLength({ maxLength: 512 })]"
show-required
auto-focus
/>
<FormTextArea
name="description"
label="Project description"
placeholder="Description (optional)"
size="lg"
:rules="[isStringOfLength({ maxLength: 65536 })]"
/>
</div>
<div
class="flex flex-col space-y-4 items-end md:flex-row md:justify-between md:items-center md:space-y-0"
>
<ProjectVisibilitySelect
v-model="visibility"
class="sm:max-w-none w-full sm:w-80"
mount-menu-on-body
/>
</div>
</form>
</LayoutDialog>
</template>
<script setup lang="ts">
import { useForm } from 'vee-validate'
import { ProjectVisibility } from '~~/lib/common/generated/gql/graphql'
import { isRequired, isStringOfLength } from '~~/lib/common/helpers/validation'
import { useMixpanel } from '~~/lib/core/composables/mp'
import { useCreateProject } from '~~/lib/projects/composables/projectManagement'
type FormValues = {
name: string
description?: string
}
const emit = defineEmits<{
(e: 'created'): void
}>()
const createProject = useCreateProject()
const { handleSubmit } = useForm<FormValues>()
const visibility = ref(ProjectVisibility.Unlisted)
const open = defineModel<boolean>('open', { required: true })
const mp = useMixpanel()
const onSubmit = handleSubmit(async (values) => {
await createProject({
...values,
visibility: visibility.value
})
emit('created')
mp.track('Stream Action', { type: 'action', name: 'create' })
open.value = false
})
const dialogButtons = computed(() => [
{
text: 'Cancel',
props: { color: 'secondary', fullWidth: true },
onClick: () => {
open.value = false
}
},
{
text: 'Create',
props: {
color: 'primary',
fullWidth: true,
outline: true,
submit: true
},
onClick: onSubmit
}
])
</script>