Added dialog for logout function
This commit is contained in:
1 parent
cb78a856f6
commit
edf922539a
4 files changed
+76
-23
No files matched your search
@@ -22,8 +22,8 @@ const config = {
|
|||||||
|
|
||||||
// GitHub pages deployment config.
|
// GitHub pages deployment config.
|
||||||
// If you aren't using GitHub pages, you don't need these.
|
// If you aren't using GitHub pages, you don't need these.
|
||||||
organizationName: 'facebook', // Usually your GitHub org/user name.
|
organizationName: 'wirediv', // Usually your GitHub org/user name.
|
||||||
projectName: 'docusaurus', // Usually your repo name.
|
projectName: 'ai-course', // Usually your repo name.
|
||||||
|
|
||||||
onBrokenLinks: 'throw',
|
onBrokenLinks: 'throw',
|
||||||
onBrokenMarkdownLinks: 'warn',
|
onBrokenMarkdownLinks: 'warn',
|
||||||
@@ -46,7 +46,7 @@ const config = {
|
|||||||
// Please change this to your repo.
|
// Please change this to your repo.
|
||||||
// Remove this to remove the "edit this page" links.
|
// Remove this to remove the "edit this page" links.
|
||||||
editUrl:
|
editUrl:
|
||||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
'https://github.com/wirediv/ai-course/tree/main/',
|
||||||
},
|
},
|
||||||
blog: {
|
blog: {
|
||||||
showReadingTime: true,
|
showReadingTime: true,
|
||||||
@@ -57,7 +57,7 @@ const config = {
|
|||||||
// Please change this to your repo.
|
// Please change this to your repo.
|
||||||
// Remove this to remove the "edit this page" links.
|
// Remove this to remove the "edit this page" links.
|
||||||
editUrl:
|
editUrl:
|
||||||
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
|
'https://github.com/wirediv/ai-course/tree/main/',
|
||||||
// Useful options to enforce blogging best practices
|
// Useful options to enforce blogging best practices
|
||||||
onInlineTags: 'warn',
|
onInlineTags: 'warn',
|
||||||
onInlineAuthors: 'warn',
|
onInlineAuthors: 'warn',
|
||||||
@@ -95,7 +95,7 @@ const config = {
|
|||||||
},
|
},
|
||||||
{to: '/blog', label: 'Blog', position: 'left'},
|
{to: '/blog', label: 'Blog', position: 'left'},
|
||||||
{
|
{
|
||||||
href: 'https://github.com/facebook/docusaurus',
|
href: 'https://github.com/wirediv/ai-course',
|
||||||
label: 'GitHub',
|
label: 'GitHub',
|
||||||
position: 'right',
|
position: 'right',
|
||||||
},
|
},
|
||||||
|
|||||||
+14
-14
@@ -6,25 +6,25 @@
|
|||||||
|
|
||||||
/* You can override the default Infima variables here. */
|
/* You can override the default Infima variables here. */
|
||||||
:root {
|
:root {
|
||||||
--ifm-color-primary: #2e8555;
|
--ifm-color-primary: #398aab; /* Base Blue-Teal */
|
||||||
--ifm-color-primary-dark: #29784c;
|
--ifm-color-primary-dark: #327c98; /* Slightly Darker */
|
||||||
--ifm-color-primary-darker: #277148;
|
--ifm-color-primary-darker: #2c6f87; /* Muted Dark */
|
||||||
--ifm-color-primary-darkest: #205d3b;
|
--ifm-color-primary-darkest: #22586b; /* Deep Dark Teal */
|
||||||
--ifm-color-primary-light: #33925d;
|
--ifm-color-primary-light: #4c9bc0; /* Slightly Lighter */
|
||||||
--ifm-color-primary-lighter: #359962;
|
--ifm-color-primary-lighter: #69accd; /* Softer Blue-Teal */
|
||||||
--ifm-color-primary-lightest: #3cad6e;
|
--ifm-color-primary-lightest: #98cde4; /* Very Light Sky Blue */
|
||||||
--ifm-code-font-size: 95%;
|
--ifm-code-font-size: 95%;
|
||||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For readability concerns, you should choose a lighter palette in dark mode. */
|
/* For readability concerns, you should choose a lighter palette in dark mode. */
|
||||||
[data-theme='dark'] {
|
[data-theme='dark'] {
|
||||||
--ifm-color-primary: #25c2a0;
|
--ifm-color-primary: #4195b6; /* Base Blue-Teal */
|
||||||
--ifm-color-primary-dark: #21af90;
|
--ifm-color-primary-dark: #327c98; /* Muted Dark */
|
||||||
--ifm-color-primary-darker: #1fa588;
|
--ifm-color-primary-darker: #2b6e86; /* Deeper Blue */
|
||||||
--ifm-color-primary-darkest: #1a8870;
|
--ifm-color-primary-darkest: #1e5466; /* Darkest Accent */
|
||||||
--ifm-color-primary-light: #29d5b0;
|
--ifm-color-primary-light: #4c9bc0; /* Brighter Accent */
|
||||||
--ifm-color-primary-lighter: #32d8b4;
|
--ifm-color-primary-lighter: #68aecf; /* Softer Blue */
|
||||||
--ifm-color-primary-lightest: #4fddbf;
|
--ifm-color-primary-lightest: #8fc8e0; /* Glowy Light Blue */
|
||||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
+5
-2
@@ -27,7 +27,7 @@ export default function Login() {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
marginRight: "auto",
|
marginRight: "auto",
|
||||||
marginLeft: "auto",
|
marginLeft: "auto",
|
||||||
flexDirection: 'column'
|
flexDirection: 'column',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<form
|
<form
|
||||||
@@ -37,6 +37,9 @@ export default function Login() {
|
|||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
width: "400px",
|
width: "400px",
|
||||||
margin: "auto",
|
margin: "auto",
|
||||||
|
padding: '32px',
|
||||||
|
borderRadius: '12px',
|
||||||
|
boxShadow: '0 4px 10px rgba(0, 0, 0, 0.1)',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img src="img/combination-icon.png" width={'100px'} style={{ margin: "auto" }} />
|
<img src="img/combination-icon.png" width={'100px'} style={{ margin: "auto" }} />
|
||||||
@@ -80,7 +83,7 @@ export default function Login() {
|
|||||||
padding: "10px",
|
padding: "10px",
|
||||||
borderRadius: "5px",
|
borderRadius: "5px",
|
||||||
border: "none",
|
border: "none",
|
||||||
backgroundColor: "#fd5367",
|
backgroundColor: "var(--ifm-color-primary)",
|
||||||
color: "white",
|
color: "white",
|
||||||
marginTop: '1rem'
|
marginTop: '1rem'
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,14 +1,64 @@
|
|||||||
import React from 'react';
|
import React, { useRef} from 'react';
|
||||||
import ColorModeToggle from '@theme-original/ColorModeToggle';
|
import ColorModeToggle from '@theme-original/ColorModeToggle';
|
||||||
import {logout} from '@site/src/pocketbase';
|
import {logout} from '@site/src/pocketbase';
|
||||||
|
|
||||||
export default function ColorModeToggleWrapper(props) {
|
export default function ColorModeToggleWrapper(props) {
|
||||||
|
const dialogRef = useRef(null)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ColorModeToggle {...props} />
|
<ColorModeToggle {...props} />
|
||||||
<a style={{background: '#fd5469', color: 'white', paddingRight: 10, paddingLeft: 10, paddingBottom: 2, borderRadius: 5, marginLeft: 15, cursor: "pointer"}} onClick={() => logout(() => window.location.reload())}>
|
<a onClick={() => dialogRef.current.showModal()} style={{background: 'var(--ifm-color-primary)', color: 'white', paddingRight: 10, paddingLeft: 10, paddingBottom: 2, borderRadius: 5, marginLeft: 15, cursor: "pointer"}}>
|
||||||
Logout
|
Logout
|
||||||
</a>
|
</a>
|
||||||
|
<dialog ref={dialogRef} style={{
|
||||||
|
padding: '20px',
|
||||||
|
borderRadius: '10px',
|
||||||
|
border: 'none',
|
||||||
|
boxShadow: '0 4px 10px rgba(0, 0, 0, 0.23)',
|
||||||
|
width: '400px',
|
||||||
|
textAlign: 'center',
|
||||||
|
}}>
|
||||||
|
<style>
|
||||||
|
{`
|
||||||
|
dialog::backdrop {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
backdrop-filter: blur(8px) brightness(0.8);
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
|
<h2>Are you sure?</h2>
|
||||||
|
{/* Close Button */}
|
||||||
|
<button
|
||||||
|
onClick={() => dialogRef.current.close()}
|
||||||
|
style={{
|
||||||
|
marginTop: '10px',
|
||||||
|
padding: '8px 12px',
|
||||||
|
borderRadius: '6px',
|
||||||
|
color: 'var(--ifm-color-primary-dark)',
|
||||||
|
border: 'none',
|
||||||
|
cursor: 'pointer',
|
||||||
|
marginRight: '5px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
{/* Close Button */}
|
||||||
|
<button
|
||||||
|
onClick={() => logout() }
|
||||||
|
style={{
|
||||||
|
marginTop: '10px',
|
||||||
|
padding: '8px 12px',
|
||||||
|
borderRadius: '6px',
|
||||||
|
backgroundColor: 'var(--ifm-color-primary-dark)',
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
cursor: 'pointer',
|
||||||
|
marginLeft: '5px'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Logout
|
||||||
|
</button>
|
||||||
|
</dialog>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user