Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- feature: 26 shinkai roadmap internal logout warning #66

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
49cacb2
- feature: added feature to export encrypted credentials
agallardol Oct 31, 2023
a34c7ad
- feature: added logout warning
agallardol Oct 31, 2023
65289b8
Merge branch 'agallardol/25-encrypt-credentials' into agallardol/xx-s…
agallardol Oct 31, 2023
996db51
- fix: added navigate to export connection
agallardol Oct 31, 2023
9b0b983
- feature: added encryption/decryption method
agallardol Oct 31, 2023
e5bfa6a
Merge branch 'agallardol/25-encrypt-credentials' into agallardol/xx-s…
agallardol Oct 31, 2023
6eeedc5
- fix: fixed text color
agallardol Oct 31, 2023
10efb3f
- feature: added quick connection workflow
agallardol Oct 31, 2023
1a6292a
- refactor: key file generation
agallardol Nov 2, 2023
874ada5
- feature: integrated export connection file and restore
agallardol Nov 2, 2023
241deb3
- fix: connection method option height
agallardol Nov 2, 2023
7dfb2e1
- fix: ui fixes
agallardol Nov 2, 2023
ca68796
Merge branch 'main' into agallardol/25-encrypt-credentials
agallardol Nov 2, 2023
82a1396
Merge branch 'agallardol/25-encrypt-credentials' into agallardol/xx-s…
agallardol Nov 2, 2023
55d5c21
- improve: change logout with delete conncection
agallardol Nov 2, 2023
1c9834f
- fix: connected qr-code workflow
agallardol Nov 2, 2023
bc799f7
- refactor: page header
agallardol Nov 2, 2023
88775aa
- feature: implemented qr-code connection method
agallardol Nov 2, 2023
f14a1fe
- fix: removed unused depedencies
agallardol Nov 2, 2023
7e348ac
- fix: encrypt param error
agallardol Nov 2, 2023
ca4742b
- fix: ui fixes and improvemens
agallardol Nov 2, 2023
47e52bf
Merge branch 'agallardol/25-encrypt-credentials' into agallardol/26-s…
agallardol Nov 2, 2023
f4e3413
Merge branch 'main' into agallardol/26-shinkai-roadmap-internal-logou…
agallardol Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions apps/shinkai-visor/src/components/nav/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Menu,
MessageCircle,
Settings,
Unplug,
Workflow,
X,
} from 'lucide-react';
Expand All @@ -17,6 +18,16 @@ import visorLogo from '../../assets/icons/visor.svg';
import { srcUrlResolver } from '../../helpers/src-url-resolver';
import { useAuth } from '../../store/auth/auth';
import { useUIContainer } from '../../store/ui-container/ui-container';
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '../ui/alert-dialog';
import { Button } from '../ui/button';
import {
DropdownMenu,
Expand Down Expand Up @@ -52,6 +63,8 @@ export default function NavBar() {
'/settings',
'/nodes/connect/method/quick-start',
].includes(location.pathname);
const [isConfirmLogoutDialogOpened, setIsConfirmLogoutDialogOpened] = useState(false)

const goBack = () => {
history.goBack();
};
Expand Down Expand Up @@ -81,14 +94,39 @@ export default function NavBar() {
history.push('/settings');
break;
case MenuOption.Logout:
logout();
setIsConfirmLogoutDialogOpened(true);
break;
default:
break;
}
};
const exportConnection = () => {
history.push('settings/export-connection');
};
return (
<nav className="">
<AlertDialog open={isConfirmLogoutDialogOpened}>
<AlertDialogContent className="w-[75%]">
<AlertDialogHeader>
<AlertDialogTitle><FormattedMessage id="are-you-sure"/></AlertDialogTitle>
<AlertDialogDescription>
<div className="flex flex-col space-y-3">
<div className="flex flex-col space-y-1">
<span className="text-xs italic"><FormattedMessage id="permanently-lose-connection"/></span>
</div>
<div className="flex flex-col">
<span className="underline decoration-dashed cursor-pointer" onClick={() => exportConnection()}>Export your conection</span>
<span className="text-xs">If you want to use it later</span>
</div>
</div>
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel onClick={() => setIsConfirmLogoutDialogOpened(false)}>Cancel</AlertDialogCancel>
<AlertDialogAction onClick={() => logout()}>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
<div className="flex items-center justify-between">
<div
className={`flex-none ${
Expand Down Expand Up @@ -184,9 +222,9 @@ export default function NavBar() {
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.Logout)}
>
<LogOut className="mr-2 h-4 w-4" />
<Unplug className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="logout" />
<FormattedMessage id="disconnect" />
</span>
</DropdownMenuItem>
</DropdownMenuContent>
Expand Down
141 changes: 141 additions & 0 deletions apps/shinkai-visor/src/components/ui/alert-dialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
'use client';

import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
import * as React from 'react';

import { cn } from '../../helpers/cn-utils';
import { buttonVariants } from './button';

const AlertDialog = AlertDialogPrimitive.Root;

const AlertDialogTrigger = AlertDialogPrimitive.Trigger;

const AlertDialogPortal = AlertDialogPrimitive.Portal;

const AlertDialogOverlay = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
>(({ className, children, ...props }, ref) => (
<AlertDialogPrimitive.Overlay
className={cn(
'fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
)}
{...props}
ref={ref}
/>
));
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;

const AlertDialogContent = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
>(({ className, ...props }, ref) => (
<AlertDialogPortal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
className={cn(
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-secondary-600 p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg md:w-full',
className
)}
ref={ref}
{...props}
/>
</AlertDialogPortal>
));
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;

const AlertDialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
'flex flex-col space-y-2 text-center sm:text-left',
className
)}
{...props}
/>
);
AlertDialogHeader.displayName = 'AlertDialogHeader';

const AlertDialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
className
)}
{...props}
/>
);
AlertDialogFooter.displayName = 'AlertDialogFooter';

const AlertDialogTitle = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Title
className={cn('text-lg font-semibold', className)}
ref={ref}
{...props}
/>
));
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;

const AlertDialogDescription = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Description
className={cn('text-sm text-foreground', className)}
ref={ref}
{...props}
/>
));
AlertDialogDescription.displayName =
AlertDialogPrimitive.Description.displayName;

const AlertDialogAction = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Action>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Action
className={cn(buttonVariants(), className)}
ref={ref}
{...props}
/>
));
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;

const AlertDialogCancel = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Cancel
className={cn(
buttonVariants({ variant: 'outline' }),
'mt-2 sm:mt-0 text-secondary-600',
className
)}
ref={ref}
{...props}
/>
));
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;

export {
AlertDialog,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogAction,
AlertDialogCancel,
};
9 changes: 7 additions & 2 deletions apps/shinkai-visor/src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"connect-manually": "Do not have a QR Code? Connect manually",
"scan": "Scan",
"review": "Review",
"logout": "Logout",
"disconnect": "Disconnect",
"message-receiver": "Message receiver",
"message.one": "Message",
"message.other": "Messages",
Expand Down Expand Up @@ -74,5 +74,10 @@
"encrypted-connection": "Encrypted connection",
"click-to-upload": "Click to upload or drag and drop",
"restore-connection": "Restore connection",
"did-you-connected-before": "Do you have experience using shinkai?"
"did-you-connected-before": "Do you have experience using shinkai?",
"cancel": "Cancel",
"continue": "Continue",
"are-you-sure": "Are you absolutely sure?",
"permanently-lose-connection": "This action will permanently delete your connection with your Shinkai Node",
"action-cant-be-undone": "This action cannot be undone"
}
9 changes: 7 additions & 2 deletions apps/shinkai-visor/src/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"connect-manually": "¿No tienes un código QR? Conectar manualmente",
"scan": "Escanear",
"review": "Revisar",
"logout": "Cerrar sesión",
"disconnect": "Desconectar",
"message-receiver": "Message receiver",
"message.one": "Mensaje",
"message.other": "Mensajes",
Expand Down Expand Up @@ -74,5 +74,10 @@
"encrypted-connection": "Conexión cifrada",
"click-to-upload": "Haz clic para subir o arrastra y suelta",
"restore-connection": "Restaurar conexión",
"did-you-connected-before": "¿Tienes experiencia usando shinkai?"
"did-you-connected-before": "¿Tienes experiencia usando shinkai?",
"cancel": "Cancelar",
"continue": "Continuar",
"are-you-sure": "Estás absolutamente seguro?",
"permanently-lose-connection": "Esta acción eliminará permanentemente la conexión con tu Shinkai Node",
"action-cant-be-undone": "Esta acción no se puede revertir"
}
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"@lottiefiles/react-lottie-player": "^3.5.3",
"@noble/ed25519": "^2.0.0",
"@noble/hashes": "^1.3.1",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
Expand Down