Skip to content

Commit

Permalink
feat: enable custom domain edition only on turbo and legacy spaces (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e authored Jan 9, 2025
1 parent ca1a032 commit 572446d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
17 changes: 9 additions & 8 deletions apps/ui/src/components/FormSpaceAdvanced.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { getValidator } from '@/helpers/validation';
import { NetworkID } from '@/types';
import { NetworkID, Space } from '@/types';
const CHILDREN_LIMIT = 16;
Expand Down Expand Up @@ -47,7 +47,7 @@ const isPrivate = defineModel<boolean>('isPrivate', { required: true });
const props = defineProps<{
networkId: NetworkID;
spaceId: string;
space: Space;
isController: boolean;
}>();
Expand Down Expand Up @@ -106,11 +106,11 @@ const formErrors = computed(() => {
}
);
if (parent.value === props.spaceId) {
if (parent.value === props.space.id) {
errors.parent = 'Space cannot be a parent of itself';
}
if (child.value === props.spaceId) {
if (child.value === props.space.id) {
errors.child = 'Space cannot be a sub-space of itself';
}
Expand Down Expand Up @@ -178,11 +178,11 @@ watchEffect(() => {
</div>
<div class="flex flex-wrap gap-2">
<div
v-for="(space, i) in children"
:key="space"
v-for="(childSpace, i) in children"
:key="childSpace"
class="flex items-center gap-2 rounded-lg border px-3 py-2 w-fit"
>
<span>{{ space }}</span>
<span>{{ childSpace }}</span>
<button type="button" @click="deleteChild(i)">
<IH-x-mark class="w-[16px]" />
</button>
Expand Down Expand Up @@ -210,6 +210,7 @@ watchEffect(() => {
v-model="customDomain"
:definition="CUSTOM_DOMAIN_DEFINITION"
:error="formErrors.customDomain"
:disabled="!space.turbo && !space.additionalRawData?.domain"
/>
<UiSwitch v-model="isPrivate" title="Hide space from homepage" />
</div>
Expand Down Expand Up @@ -238,7 +239,7 @@ watchEffect(() => {
<teleport to="#modal">
<ModalDeleteSpace
:open="isDeleteSpaceModalOpen"
:space-id="spaceId"
:space-id="space.id"
@confirm="emit('deleteSpace')"
@close="isDeleteSpaceModalOpen = false"
/>
Expand Down
4 changes: 4 additions & 0 deletions apps/ui/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ a,

input {
@apply outline-none;

&[disabled] {
@apply cursor-not-allowed;
}
}

.choice-bg {
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/views/Space/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ watchEffect(() => setTitle(`Edit settings - ${props.space.name}`));
v-model:custom-domain="customDomain"
v-model:is-private="isPrivate"
:network-id="space.network"
:space-id="space.id"
:space="space"
:is-controller="isController"
@delete-space="handleSpaceDelete"
@update-validity="
Expand Down

0 comments on commit 572446d

Please sign in to comment.