Files
speckle-server/packages/frontend-2/components/project/VisibilitySelect.vue
T
Benjamin Ottensten fc76fd9f4f Various polishing around the product (#2427)
* Update header navigation

Logo, share button color, breadcrumb colors, spacings

* Updates to main button component

Shadows, border on secondary button, less spacings to icons

* Update spacings in dialog after bew button styling

* Use secondary button in embed dialog

* Update select inputs

Spacing, icon, border on dropdown, smaller avatars

* Update inputs to use the new styling

* Various copy updates

* Update icons

Smaller icons, outline instead of solid, removed some icons that were unnecessary

* Switch order of actions in Delete dialog

* Update styling of inline New model action

* Remove strange BG effect on comments component

* Update styling of hide/isolate actions in viewer

Was necessary after the button styling change. But new copy also makes it more usable.

* Fix alignment issue in selection info panel

* Align styling in Viewer panel component

* Clean up measure usage tips

A permanent "Right click to cancel measurement" tip isn't needed

* Panel spacing

* Update actions in the add model to viewer dialog

* Update permissions input in new project dialog

* Two minor things

* Remove unnecessary flex classes

---------

Co-authored-by: andrewwallacespeckle <andrew@speckle.systems>
2024-06-25 14:43:50 +02:00

89 lines
2.3 KiB
Vue

<template>
<FormSelectBase
v-model="selectValue"
:items="Object.values(items)"
label="Project visibility"
:show-label="showLabel"
:name="name || 'visibility'"
:allow-unset="false"
:disabled="disabled"
:label-id="labelId"
:button-id="buttonId"
by="id"
:help="
disabled
? 'You must be an Owner of this project to change this setting'
: undefined
"
>
<template #something-selected="{ value }">
<div class="text-sm">
<div class="label">
{{ isArray(value) ? value[0].title : value.title }}
</div>
<span class="text-foreground-2 text-xs sm:text-sm">
{{ isArray(value) ? value[0].description : value.description }}
</span>
</div>
</template>
<template #option="{ item }">
<div class="flex flex-col">
<div class="label">{{ item.title }}</div>
<div class="label label--light text-foreground-2 text-xs sm:text-sm">
{{ item.description }}
</div>
</div>
</template>
</FormSelectBase>
</template>
<script setup lang="ts">
import { ProjectVisibility } from '~~/lib/common/generated/gql/graphql'
import { isArray } from 'lodash-es'
const emit = defineEmits<{
(e: 'update:modelValue', v: ProjectVisibility): void
}>()
const props = defineProps<{
modelValue: ProjectVisibility
showLabel?: boolean
name?: string
disabled?: boolean
}>()
const labelId = useId()
const buttonId = useId()
const items = ref<
Record<
ProjectVisibility,
{ id: ProjectVisibility; description: string; title: string }
>
>({
[ProjectVisibility.Public]: {
id: ProjectVisibility.Public,
description: 'Project is visible to everyone',
title: 'Discoverable'
},
[ProjectVisibility.Unlisted]: {
id: ProjectVisibility.Unlisted,
description: 'Anyone with the link can view',
title: 'Link Shareable'
},
[ProjectVisibility.Private]: {
id: ProjectVisibility.Private,
description: 'Only collaborators can access',
title: 'Private'
}
})
const selectedValue = computed({
get: () => props.modelValue,
set: (newVal) => emit('update:modelValue', newVal)
})
const selectValue = computed({
get: () => items.value[selectedValue.value],
set: (newVal) => (selectedValue.value = newVal.id)
})
</script>