mirror of https://github.com/nocodb/nocodb
Wing-Kam Wong
2 years ago
28 changed files with 853 additions and 287 deletions
@ -1,40 +0,0 @@
|
||||
html, |
||||
body, |
||||
#__nuxt, |
||||
.v-application__wrap { |
||||
@apply m-0 h-full w-full bg-white dark:(bg-black text-white); |
||||
} |
||||
|
||||
.v-main { |
||||
@apply w-full h-full; |
||||
overflow: hidden; |
||||
flex: unset !important; |
||||
} |
||||
|
||||
.v-main .v-main__wrap { |
||||
@apply flex-0 w-full relative scrollbar-thin-primary; |
||||
overflow-x: hidden; |
||||
} |
||||
|
||||
nav, |
||||
nav .v-list { |
||||
@apply dark:(bg-gray-900 text-white) |
||||
} |
||||
|
||||
.v-divider { |
||||
@apply dark:bg-white |
||||
} |
||||
|
||||
.page-enter-active, |
||||
.page-leave-active, |
||||
.layout-enter-active, |
||||
.layout-leave-active { |
||||
@apply transition-opacity duration-300 ease-in-out; |
||||
} |
||||
|
||||
.page-enter, |
||||
.page-leave-active, |
||||
.layout-enter, |
||||
.layout-leave-active { |
||||
@apply opacity-0; |
||||
} |
@ -0,0 +1,70 @@
|
||||
html, |
||||
body, |
||||
#__nuxt, |
||||
.ant-layout, |
||||
main { |
||||
@apply m-0 h-full w-full bg-white dark:(bg-black text-white); |
||||
} |
||||
|
||||
main { |
||||
@apply flex-0 w-full relative scrollbar-thin-primary; |
||||
overflow-x: hidden; |
||||
} |
||||
|
||||
nav, |
||||
nav .v-list { |
||||
@apply dark:(!bg-gray-900 text-white) |
||||
} |
||||
|
||||
.v-divider { |
||||
@apply dark:bg-white |
||||
} |
||||
|
||||
.page-enter-active, |
||||
.page-leave-active, |
||||
.layout-enter-active, |
||||
.layout-leave-active { |
||||
@apply transition-opacity duration-300 ease-in-out; |
||||
} |
||||
|
||||
.page-enter, |
||||
.page-leave-active, |
||||
.layout-enter, |
||||
.layout-leave-active { |
||||
@apply opacity-0; |
||||
} |
||||
|
||||
.slide-enter-active, |
||||
.slide-leave-active { |
||||
@apply transition-all duration-200 ease-in-out; |
||||
transform: translate(100%, 0); |
||||
} |
||||
|
||||
.slide-enter, |
||||
.slide-leave-active { |
||||
transform: translate(-100%, 0); |
||||
} |
||||
|
||||
a { |
||||
@apply prose text-primary underline hover:opacity-75 dark:(text-secondary) hover:(opacity-75); |
||||
} |
||||
|
||||
h1, h2, h3, h4, h5, h6 { |
||||
@apply text-black dark:(text-white); |
||||
} |
||||
|
||||
.v-field__field { |
||||
@apply bg-white dark:(!bg-gray-900 text-white); |
||||
|
||||
input { |
||||
@apply bg-white dark:(!bg-gray-700) !appearance-none my-1 border-1 border-solid border-primary/50 rounded; |
||||
} |
||||
} |
||||
|
||||
.nc-icon { |
||||
@apply color-transition; |
||||
} |
||||
|
||||
:root { |
||||
--header-height: 64px; |
||||
} |
@ -0,0 +1,14 @@
|
||||
<script lang="ts" setup> |
||||
interface Props { |
||||
width?: number |
||||
height?: number |
||||
} |
||||
|
||||
const { width = 90, height = 90 } = defineProps<Props>() |
||||
</script> |
||||
|
||||
<template> |
||||
<div :style="{ left: `calc(50% - ${width / 2}px)`, top: `-${height * 0.6}px` }" class="absolute rounded-lg bg-primary"> |
||||
<img :width="width" :height="height" alt="NocoDB" src="~/assets/img/icons/512x512-trans.png" /> |
||||
</div> |
||||
</template> |
@ -0,0 +1,128 @@
|
||||
<script setup lang="ts"> |
||||
import { useI18n } from 'vue-i18n' |
||||
import { definePageMeta } from '#imports' |
||||
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' |
||||
import { useNuxtApp } from '#app' |
||||
import { isEmail } from '~/utils/validation' |
||||
import MdiLogin from '~icons/mdi/login' |
||||
import MaterialSymbolsWarning from '~icons/material-symbols/warning' |
||||
import ClaritySuccessLine from '~icons/clarity/success-line' |
||||
|
||||
const { $api } = $(useNuxtApp()) |
||||
|
||||
const { t } = useI18n() |
||||
|
||||
definePageMeta({ |
||||
requiresAuth: false, |
||||
title: 'title.resetPassword', |
||||
}) |
||||
|
||||
let error = $ref<string | null>(null) |
||||
let success = $ref(false) |
||||
|
||||
const valid = ref() |
||||
|
||||
const formValidator = ref() |
||||
|
||||
const form = reactive({ |
||||
email: '', |
||||
}) |
||||
|
||||
const formRules = { |
||||
email: [ |
||||
// E-mail is required |
||||
(v: string) => !!v || t('msg.error.signUpRules.emailReqd'), |
||||
// E-mail must be valid format |
||||
(v: string) => isEmail(v) || t('msg.error.signUpRules.emailInvalid'), |
||||
], |
||||
} |
||||
|
||||
const resetPassword = async () => { |
||||
error = null |
||||
try { |
||||
await $api.auth.passwordForgot(form) |
||||
success = true |
||||
} catch (e: any) { |
||||
// todo: errors should not expose what was wrong (i.e. do not show "Password is wrong" messages) |
||||
error = await extractSdkResponseErrorMsg(e) |
||||
} |
||||
} |
||||
|
||||
const resetError = () => { |
||||
if (error) { |
||||
error = null |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<template> |
||||
<NuxtLayout> |
||||
<v-form |
||||
ref="formValidator" |
||||
v-model="valid" |
||||
class="h-full min-h-[600px] flex justify-center items-center" |
||||
@submit.prevent="resetPassword" |
||||
> |
||||
<div class="h-full w-full flex flex-col flex-wrap justify-center items-center"> |
||||
<div |
||||
class="color-transition bg-white dark:(!bg-gray-900 !text-white) md:relative flex flex-col justify-center gap-2 w-full max-w-[500px] mx-auto p-8 md:(rounded-lg border-1 border-gray-200 shadow-xl)" |
||||
> |
||||
<general-noco-icon /> |
||||
|
||||
<div class="self-center flex flex-col justify-center items-center text-center gap-4"> |
||||
<h1 class="prose-2xl font-bold my-4 w-full">{{ $t('title.resetPassword') }}</h1> |
||||
|
||||
<template v-if="!success"> |
||||
<p class="prose-sm">{{ $t('msg.info.passwordRecovery.message_1') }}</p> |
||||
<p class="prose-sm mb-4">{{ $t('msg.info.passwordRecovery.message_2') }}</p> |
||||
</template> |
||||
<template v-else> |
||||
<p class="prose-sm text-success flex items-center leading-8 gap-2"> |
||||
{{ $t('msg.info.passwordRecovery.success') }} <ClaritySuccessLine /> |
||||
</p> |
||||
|
||||
<nuxt-link to="/signin">{{ $t('general.signIn') }}</nuxt-link> |
||||
</template> |
||||
</div> |
||||
|
||||
<Transition name="layout"> |
||||
<div v-if="error" class="self-center mb-4 bg-red-500 text-white rounded-lg w-3/4 p-1"> |
||||
<div class="flex items-center gap-2 justify-center"><MaterialSymbolsWarning /> {{ error }}</div> |
||||
</div> |
||||
</Transition> |
||||
|
||||
<v-text-field |
||||
id="email" |
||||
v-model="form.email" |
||||
class="bg-white dark:!bg-gray-900" |
||||
:rules="formRules.email" |
||||
:label="$t('labels.email')" |
||||
:placeholder="$t('labels.email')" |
||||
:persistent-placeholder="true" |
||||
type="text" |
||||
@focus="resetError" |
||||
/> |
||||
|
||||
<div class="self-center flex flex-wrap gap-4 items-center mt-4 md:mx-8 md:justify-between justify-center w-full"> |
||||
<button |
||||
:disabled="!valid" |
||||
:class="[ |
||||
!valid |
||||
? '!opacity-50 !cursor-default' |
||||
: 'text-white bg-primary hover:(text-primary !bg-primary/75) dark:(!bg-secondary/75 hover:!bg-secondary/50)', |
||||
]" |
||||
class="ml-1 border-1 border-solid border-gray-300 color-transition rounded-lg p-4 bg-gray-100/50" |
||||
type="submit" |
||||
> |
||||
<span class="flex items-center gap-2"><MdiLogin /> {{ $t('activity.sendEmail') }}</span> |
||||
</button> |
||||
<div class="text-end prose-sm"> |
||||
{{ $t('msg.info.signUp.alreadyHaveAccount') }} |
||||
<nuxt-link to="/signin">{{ $t('general.signIn') }}</nuxt-link> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</v-form> |
||||
</NuxtLayout> |
||||
</template> |
@ -1,13 +0,0 @@
|
||||
<script setup lang="ts"> |
||||
import { useRouter } from '#app' |
||||
|
||||
const router = useRouter() |
||||
|
||||
router.replace('/projects') |
||||
</script> |
||||
|
||||
<template> |
||||
<div class="container" /> |
||||
</template> |
||||
|
||||
<style lang="scss"></style> |
@ -0,0 +1,150 @@
|
||||
<script lang="ts" setup> |
||||
import { createVNode } from '@vue/runtime-core' |
||||
import { Modal } from 'ant-design-vue' |
||||
import type { ProjectType } from 'nocodb-sdk' |
||||
import { useToast } from 'vue-toastification' |
||||
import { navigateTo } from '#app' |
||||
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' |
||||
import MaterialSymbolsFormatListBulletedRounded from '~icons/material-symbols/format-list-bulleted-rounded' |
||||
import MaterialSymbolsGridView from '~icons/material-symbols/grid-view' |
||||
import MdiPlus from '~icons/mdi/plus' |
||||
import MdiDatabaseOutline from '~icons/mdi/database-outline' |
||||
import MdiFolderOutline from '~icons/mdi/folder-outline' |
||||
import ExclamationCircleOutlined from '~icons/mdi/information-outline' |
||||
|
||||
const navDrawerOptions = [ |
||||
{ |
||||
title: 'My NocoDB', |
||||
icon: MdiFolderOutline, |
||||
}, |
||||
/* todo: implement the api and bring back the options below |
||||
{ |
||||
title: "Shared With Me", |
||||
icon: MdiAccountGroup |
||||
}, |
||||
{ |
||||
title: "Recent", |
||||
icon: MdiClockOutline |
||||
}, |
||||
{ |
||||
title: "Starred", |
||||
icon: MdiStar |
||||
} */ |
||||
] |
||||
|
||||
const route = useRoute() |
||||
|
||||
const { $api } = useNuxtApp() |
||||
const toast = useToast() |
||||
|
||||
const response = await $api.project.list({}) |
||||
const projects = $ref(response.list) |
||||
const activePage = $ref(navDrawerOptions[0].title) |
||||
const deleteProject = (project: ProjectType) => { |
||||
Modal.confirm({ |
||||
title: 'Do you want to delete the project?', |
||||
// icon: createVNode(ExclamationCircleOutlined), |
||||
content: 'Some descriptions', |
||||
okText: 'Yes', |
||||
okType: 'danger', |
||||
cancelText: 'No', |
||||
async onOk() { |
||||
try { |
||||
await $api.project.delete(project.id as string) |
||||
projects.splice(projects.indexOf(project), 1) |
||||
} catch (e) { |
||||
toast.error(await extractSdkResponseErrorMsg(e)) |
||||
} |
||||
}, |
||||
}) |
||||
} |
||||
|
||||
const visible = ref(true) |
||||
</script> |
||||
|
||||
<template> |
||||
<NuxtLayout> |
||||
<template #sidebar> |
||||
<div class="flex flex-col h-full"> |
||||
<div class="flex p-4"> |
||||
<v-menu class="select-none"> |
||||
<template #activator="{ props }"> |
||||
<div |
||||
class="color-transition hover:(bg-gray-100 dark:bg-secondary/25) dark:(bg-secondary/50 !text-white shadow-gray-600) mr-auto select-none flex items-center gap-2 leading-8 cursor-pointer rounded-full border-1 border-gray-300 px-5 py-2 shadow prose-lg font-semibold" |
||||
@click="props.onClick" |
||||
> |
||||
<MdiPlus class="text-primary dark:(!text-white) text-2xl" /> |
||||
{{ $t('title.newProj') }} |
||||
</div> |
||||
</template> |
||||
|
||||
<v-list class="!py-0 flex flex-col bg-white rounded-lg shadow-md border-1 border-gray-300 mt-2 ml-2"> |
||||
<div |
||||
class="grid grid-cols-12 cursor-pointer hover:bg-gray-200 flex items-center p-2" |
||||
@click="navigateTo('/create')" |
||||
> |
||||
<MdiPlus class="col-span-2 mr-1 mt-[1px] text-primary text-lg" /> |
||||
<div class="col-span-10 text-sm xl:text-md">{{ $t('activity.createProject') }}</div> |
||||
</div> |
||||
<div |
||||
class="grid grid-cols-12 cursor-pointer hover:bg-gray-200 flex items-center p-2" |
||||
@click="navigateTo('/create-external')" |
||||
> |
||||
<MdiDatabaseOutline class="col-span-2 mr-1 mt-[1px] text-green-500 text-lg" /> |
||||
<div class="col-span-10 text-sm xl:text-md" v-html="$t('activity.createProjectExtended.extDB')" /> |
||||
</div> |
||||
</v-list> |
||||
</v-menu> |
||||
</div> |
||||
|
||||
<a-menu class="mx-4 dark:bg-gray-800 dark:text-white flex-1 border-0"> |
||||
<a-menu-item |
||||
v-for="(option, index) in navDrawerOptions" |
||||
:key="index" |
||||
class="f!rounded-r-lg" |
||||
@click="activePage = option.title" |
||||
> |
||||
<div class="flex items-center gap-4"> |
||||
<component :is="option.icon" /> |
||||
|
||||
<span class="font-semibold"> |
||||
{{ option.title }} |
||||
</span> |
||||
</div> |
||||
</a-menu-item> |
||||
</a-menu> |
||||
|
||||
<general-social /> |
||||
|
||||
<general-sponsors :nav="true" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<v-container class="flex-1 mb-12"> |
||||
<div class="flex"> |
||||
<div class="flex-1 text-2xl md:text-4xl font-bold text-gray-500 dark:text-white p-4"> |
||||
{{ activePage }} |
||||
</div> |
||||
|
||||
<div class="self-end flex text-4xl mb-1"> |
||||
<MaterialSymbolsGridView |
||||
:class="route.name === 'index-index' ? 'text-primary dark:(!text-secondary/75)' : ''" |
||||
class="cursor-pointer p-2 hover:bg-gray-300/50 rounded-full" |
||||
@click="navigateTo('/')" |
||||
/> |
||||
<MaterialSymbolsFormatListBulletedRounded |
||||
:class="route.name === 'index-index-list' ? 'text-primary dark:(!text-secondary/75)' : ''" |
||||
class="cursor-pointer p-2 hover:bg-gray-300/50 rounded-full" |
||||
@click="navigateTo('/list')" |
||||
/> |
||||
</div> |
||||
</div> |
||||
|
||||
<a-divider class="!mb-4 lg:(!mb-8)" /> |
||||
|
||||
<NuxtPage :projects="projects" @delete-project="deleteProject" /> |
||||
</v-container> |
||||
|
||||
<a-modal></a-modal> |
||||
</NuxtLayout> |
||||
</template> |
@ -0,0 +1,42 @@
|
||||
<script setup lang="ts"> |
||||
import { useNuxtApp, useRoute } from '#app' |
||||
import MdiAccountCog from '~icons/mdi/account-cog' |
||||
|
||||
const { $api, $state } = useNuxtApp() |
||||
|
||||
const route = useRoute() |
||||
</script> |
||||
|
||||
<template> |
||||
<NuxtLayout> |
||||
<template #sidebar> |
||||
<v-navigation-drawer v-model="$state.sidebarOpen.value" :border="0"> |
||||
<div class="flex flex-col h-full"> |
||||
<div class="advance-menu flex-1"> |
||||
<v-list class="flex flex-col gap-1" :color="$state.darkMode.value ? 'secondary' : 'primary'"> |
||||
<v-list-item |
||||
:active="route.name === 'index-user-index'" |
||||
class="flex items-center gap-4 !rounded-r-lg" |
||||
:value="$t('activity.settings')" |
||||
> |
||||
<MdiAccountCog /> |
||||
|
||||
<span class="font-semibold"> |
||||
{{ $t('activity.settings') }} |
||||
</span> |
||||
</v-list-item> |
||||
</v-list> |
||||
</div> |
||||
|
||||
<v-divider /> |
||||
|
||||
<general-social /> |
||||
|
||||
<general-sponsors :nav="true" /> |
||||
</div> |
||||
</v-navigation-drawer> |
||||
</template> |
||||
|
||||
<NuxtPage /> |
||||
</NuxtLayout> |
||||
</template> |
@ -0,0 +1,140 @@
|
||||
<script lang="ts" setup> |
||||
import { useI18n } from 'vue-i18n' |
||||
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' |
||||
import { navigateTo, useNuxtApp } from '#app' |
||||
import { isEmail } from '~/utils/validation' |
||||
import MaterialSymbolsWarning from '~icons/material-symbols/warning' |
||||
import MaterialSymbolsRocketLaunchOutline from '~icons/material-symbols/rocket-launch-outline' |
||||
import { reactive, ref } from '#imports' |
||||
|
||||
const { $api, $state } = useNuxtApp() |
||||
|
||||
const { t } = useI18n() |
||||
|
||||
const valid = ref() |
||||
let error = $ref<string | null>(null) |
||||
|
||||
const form = reactive({ |
||||
currentPassword: '', |
||||
password: '', |
||||
passwordRepeat: '', |
||||
}) |
||||
|
||||
const formRules = { |
||||
currentPassword: [ |
||||
(v: string) => !!v || t('msg.error.signUpRules.passwdRequired'), |
||||
// E-mail must be valid format |
||||
(v: string) => isEmail(v) || t('msg.error.signUpRules.emailInvalid'), |
||||
], |
||||
password: [ |
||||
// Password is required |
||||
(v: string) => !!v || t('msg.error.signUpRules.passwdRequired'), |
||||
(v: string) => v.length >= 8 || t('msg.error.signUpRules.passwdLength'), |
||||
], |
||||
passwordRepeat: [ |
||||
// Passwords match |
||||
(v: string) => v === form.password || t('msg.error.signUpRules.passwdMismatch'), |
||||
], |
||||
} |
||||
|
||||
const passwordChange = async () => { |
||||
error = null |
||||
try { |
||||
const { msg } = await $api.auth.passwordChange(form) |
||||
console.log(msg) |
||||
} catch (e: any) { |
||||
error = await extractSdkResponseErrorMsg(e) |
||||
} |
||||
} |
||||
|
||||
const resetError = () => { |
||||
if (error) { |
||||
error = null |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<template> |
||||
<v-form |
||||
ref="formValidator" |
||||
v-model="valid" |
||||
class="h-[calc(100%_+_180px)] min-h-[600px] flex justify-center items-center" |
||||
@submit.prevent="passwordChange" |
||||
> |
||||
<div class="h-full w-full flex flex-col flex-wrap justify-center items-center"> |
||||
<div |
||||
class="dark:(md:bg-gray-900 !text-white) md:relative flex flex-col justify-center gap-2 w-full max-w-[500px] mx-auto p-8 md:(rounded-lg border-1 border-gray-200 shadow-xl)" |
||||
> |
||||
<div |
||||
style="left: -moz-calc(50% - 45px); left: -webkit-calc(50% - 45px); left: calc(50% - 45px)" |
||||
class="absolute top-12 md:top-[-10%] rounded-lg bg-primary" |
||||
> |
||||
<img width="90" height="90" src="~/assets/img/icons/512x512-trans.png" /> |
||||
</div> |
||||
|
||||
<h1 class="prose-2xl font-bold self-center my-4">{{ $t('general.signUp') }}</h1> |
||||
|
||||
<Transition name="layout"> |
||||
<div v-if="error" class="self-center mb-4 bg-red-500 text-white rounded-lg w-3/4 p-1"> |
||||
<div class="flex items-center gap-2 justify-center"><MaterialSymbolsWarning /> {{ error }}</div> |
||||
</div> |
||||
</Transition> |
||||
|
||||
<v-text-field |
||||
id="email" |
||||
v-model="form.email" |
||||
class="bg-white dark:!bg-gray-900" |
||||
:rules="formRules.email" |
||||
:label="$t('labels.email')" |
||||
:placeholder="$t('labels.email')" |
||||
:persistent-placeholder="true" |
||||
type="text" |
||||
@focus="resetError" |
||||
/> |
||||
|
||||
<v-text-field |
||||
id="password" |
||||
v-model="form.password" |
||||
class="bg-white dark:!bg-gray-900" |
||||
:rules="formRules.password" |
||||
:label="$t('labels.password')" |
||||
:placeholder="$t('labels.password')" |
||||
:persistent-placeholder="true" |
||||
type="password" |
||||
@focus="resetError" |
||||
/> |
||||
|
||||
<v-text-field |
||||
id="password_repeat" |
||||
v-model="form.passwordRepeat" |
||||
class="bg-white dark:!bg-gray-900" |
||||
:rules="formRules.passwordRepeat" |
||||
:label="`Repeat ${$t('labels.password')}`" |
||||
:placeholder="`Repeat ${$t('labels.password')}`" |
||||
:persistent-placeholder="true" |
||||
type="password" |
||||
@focus="resetError" |
||||
/> |
||||
|
||||
<div class="self-center flex flex-wrap gap-4 items-center mt-4 md:mx-8 md:justify-between justify-center w-full"> |
||||
<button |
||||
:disabled="!valid" |
||||
:class="[ |
||||
!valid |
||||
? '!opacity-50 !cursor-default' |
||||
: 'shadow-md hover:(text-primary bg-primary/10 dark:text-white dark:!bg-primary/50)', |
||||
]" |
||||
class="ml-1 border-1 border-solid border-gray-300 color-transition rounded-lg p-4 bg-gray-100/50" |
||||
type="submit" |
||||
> |
||||
<span class="flex items-center gap-2"><MaterialSymbolsRocketLaunchOutline /> {{ $t('general.signUp') }}</span> |
||||
</button> |
||||
<div class="text-end prose-sm"> |
||||
{{ $t('msg.info.signUp.alreadyHaveAccount') }} |
||||
<nuxt-link to="/signin">{{ $t('general.signIn') }}</nuxt-link> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</v-form> |
||||
</template> |
Loading…
Reference in new issue