-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add workspace handle and bundle analyzer
add bundle analyzer add workspace chooser add popover for workspace handle
- Loading branch information
Showing
60 changed files
with
745 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './model' | ||
export * from './ui' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './types' | ||
export * from './workspace.store' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { User } from '@/entities/user' | ||
|
||
export interface BaseTestWorkspace { | ||
_id: string | ||
name: string | ||
img: string | Blob | ||
link: string | ||
status: 'active' | 'archive' | ||
members: User[] | ||
plan: 'FREE' | 'PREMIUM' | ||
} | ||
|
||
export type ChoosingWorkspaceItem = Pick<BaseTestWorkspace, '_id' | 'name' | 'status' | 'plan'> |
29 changes: 29 additions & 0 deletions
29
core/client/src/entities/workspace/model/workspace.store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ref } from 'vue' | ||
import { defineStore } from 'pinia' | ||
import type { User } from '@/entities/user' | ||
|
||
interface BaseTestWorkspace { | ||
_id: string | ||
name: string | ||
img: string | Blob | ||
link: string | ||
status: 'active' | 'archive' | ||
members: User[] | ||
plan: 'FREE' | 'PREMIUM' | ||
} | ||
|
||
export const useWorkspaceStore = defineStore('workspace', () => { | ||
const workspace = ref({ | ||
_id: '0', | ||
name: 'Example.io', | ||
img: 'https://avatars.githubusercontent.com/u/185750893?s=100&v=4', | ||
link: 'https://jenda-app-mnenie.com/example.io', | ||
status: 'active', | ||
members: [], | ||
plan: 'FREE', | ||
} as BaseTestWorkspace) | ||
|
||
return { | ||
workspace, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script setup lang="ts"> | ||
import type { ChoosingWorkspaceItem } from '../model' | ||
import { UiBadge, UiButton } from '@/shared/ui' | ||
defineProps<{ | ||
item: ChoosingWorkspaceItem | ||
}>() | ||
const emit = defineEmits<{ | ||
(e: 'choose', id: string): void | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<UiButton | ||
variant="dashed" | ||
class="hover:(border-neutral-500 !bg-white dark:!bg-neutral-800) focus:border-neutral-500 justify-between" | ||
@click.prevent="emit('choose', item._id)" | ||
> | ||
{{ item.name }} | ||
<div class="flex items-center gap-1.5"> | ||
<UiBadge variant="soft" class="px-1 py-0 text-xs"> | ||
{{ item.plan }} | ||
</UiBadge> | ||
<UiBadge variant="soft" class="px-1 py-0 text-xs"> | ||
{{ item.status }} | ||
</UiBadge> | ||
</div> | ||
</UiButton> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as ChoosingButton } from './ChoosingButton.vue' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
core/client/src/features/auth/sign-in/ui/WorkspaceChanger.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<script setup lang="ts"> | ||
import { useRouter } from 'vue-router/auto' | ||
import { toTypedSchema } from '@vee-validate/zod' | ||
import { useField, useForm } from 'vee-validate' | ||
import { ChoosingButton, type ChoosingWorkspaceItem } from '@/entities/workspace' | ||
import { UiButton, UiFormField, UiFormLabel, UiFormMessage } from '@/shared/ui' | ||
import { z } from '@/shared/libs/vee-validate' | ||
defineProps<{ | ||
workspaces: ChoosingWorkspaceItem[] | ||
}>() | ||
const validationSchema = toTypedSchema( | ||
z.object({ | ||
workspace: z.string().min(1), | ||
}), | ||
) | ||
const { handleSubmit, errors } = useForm({ | ||
validationSchema, | ||
}) | ||
const { value: workspace } = useField<string>('workspace') | ||
const router = useRouter() | ||
function handleWorkspaceChoose(id: string) { | ||
// console.log(id) | ||
workspace.value = id | ||
} | ||
const onChanger = handleSubmit((values) => { | ||
router.push({ name: 'boards' }) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<form @submit.prevent="onChanger"> | ||
<div class="grid gap-6"> | ||
<UiFormField v-auto-animate class="flex flex-col gap-3"> | ||
<UiFormLabel | ||
for="workspaces" | ||
> | ||
{{ $t('authentication.workspace.choosing.label') }} | ||
</UiFormLabel> | ||
<div class="flex flex-col gap-3 max-h-200px overflow-auto"> | ||
<ChoosingButton | ||
v-for="w in workspaces" | ||
:key="w._id" | ||
:item="w" | ||
@choose="handleWorkspaceChoose(w._id)" | ||
/> | ||
</div> | ||
<UiFormMessage v-if="errors.workspace" :content="errors.workspace" /> | ||
</UiFormField> | ||
<UiButton type="submit"> | ||
{{ $t('authentication.workspace.route') }} | ||
</UiButton> | ||
</div> | ||
</form> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import SignInForm from './SignInForm.vue' | ||
import WorkspaceChanger from './WorkspaceChanger.vue' | ||
|
||
export { SignInForm } | ||
export { SignInForm, WorkspaceChanger } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<script setup lang="ts"> | ||
import { shallowReactive } from 'vue' | ||
import { useHead } from '@unhead/vue' | ||
import type { ChoosingWorkspaceItem } from '@/entities/workspace' | ||
import { LayoutsEnum } from '@/layouts/model' | ||
import { WorkspaceChoosing } from '@/widgets/auth' | ||
import { WorkspaceChanger } from '@/features/auth/sign-in' | ||
definePage({ | ||
meta: { | ||
layout: LayoutsEnum.auth, | ||
requiresAuth: true, | ||
}, | ||
name: 'sign-in-workspace', | ||
}) | ||
useHead({ | ||
title: 'Sign In | Choose your workspace', | ||
}) | ||
const workspaces = shallowReactive<ChoosingWorkspaceItem[]>([ | ||
{ | ||
_id: '1', | ||
name: 'Workspace 1', | ||
plan: 'FREE', | ||
status: 'active', | ||
}, | ||
{ | ||
_id: '2', | ||
name: 'Workspace 2', | ||
plan: 'PREMIUM', | ||
status: 'active', | ||
}, | ||
]) | ||
</script> | ||
|
||
<template> | ||
<div class="auth-page"> | ||
<WorkspaceChoosing> | ||
<WorkspaceChanger :workspaces /> | ||
</WorkspaceChoosing> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.