Implement signin as guest
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
'use client';
|
||||
import { ProjectsMessages } from '@/types/project';
|
||||
import { Link } from '@/src/navigation';
|
||||
import { Button, Modal, ModalContent, ModalHeader, ModalFooter } from '@nextui-org/react';
|
||||
|
||||
type Props = {
|
||||
isOpen: boolean;
|
||||
onCancel: () => void;
|
||||
messages: ProjectsMessages;
|
||||
locale: string;
|
||||
};
|
||||
|
||||
export default function NeedSignedInDialog({ isOpen, onCancel, messages, locale }: Props) {
|
||||
return (
|
||||
<Modal
|
||||
isOpen={isOpen}
|
||||
onOpenChange={() => {
|
||||
onCancel();
|
||||
}}
|
||||
>
|
||||
<ModalContent>
|
||||
<ModalHeader className="flex flex-col gap-1">{messages.needSignedIn}</ModalHeader>
|
||||
<ModalFooter>
|
||||
<Link href={'/account/signin'} locale={locale}>
|
||||
<Button color="primary">{messages.signIn}</Button>
|
||||
</Link>
|
||||
</ModalFooter>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import { TokenContext } from '@/src/app/[locale]/TokenProvider';
|
||||
import { ProjectType, ProjectsMessages } from '@/types/project';
|
||||
import ProjectsTable from './ProjectsTable';
|
||||
import ProjectDialog from './ProjectDialog';
|
||||
import NeedSignedInDialog from './NeedSignedInDialog';
|
||||
import { fetchProjects, createProject, updateProject, deleteProject } from './projectsControl';
|
||||
|
||||
export type Props = {
|
||||
@@ -35,15 +34,9 @@ export default function ProjectsPage({ messages, locale }: Props) {
|
||||
}, [context]);
|
||||
|
||||
// dialog
|
||||
const [isNeedSignedInDialogOpen, setIsNeedSignedInDialogOpen] = useState(false);
|
||||
const [isProjectDialogOpen, setIsProjectDialogOpen] = useState(false);
|
||||
const [editingProject, setEditingProject] = useState<ProjectType | null>(null);
|
||||
const openDialogForCreate = () => {
|
||||
if (!context.isSignedIn()) {
|
||||
setIsNeedSignedInDialogOpen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setIsProjectDialogOpen(true);
|
||||
setEditingProject(null);
|
||||
};
|
||||
@@ -105,13 +98,6 @@ export default function ProjectsPage({ messages, locale }: Props) {
|
||||
onSubmit={onSubmit}
|
||||
messages={messages}
|
||||
/>
|
||||
|
||||
<NeedSignedInDialog
|
||||
isOpen={isNeedSignedInDialogOpen}
|
||||
onCancel={() => setIsNeedSignedInDialogOpen(false)}
|
||||
messages={messages}
|
||||
locale={locale}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user