Skip to content

Commit

Permalink
- fix: connected qr-code workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol committed Nov 2, 2023
1 parent ca68796 commit 1c9834f
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ enum AddNodeSteps {
Connect,
}

export const AddNode = () => {
export const ConnectMethodQrCode = () => {
const history = useHistory();
const setAuth = useAuth((state) => state.setAuth);
const DEFAULT_NODE_ADDRESS = 'http://127.0.0.1:9550';
Expand Down

This file was deleted.

181 changes: 94 additions & 87 deletions apps/shinkai-visor/src/components/nav/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ export default function NavBar() {
const uiContainer = useUIContainer((state) => state.uiContainer);

const [isMenuOpened, setMenuOpened] = useState(false);
const isRootPage = ['/inboxes', '/agents', '/settings'].includes(location.pathname);
const isRootPage = [
'/inboxes',
'/agents',
'/settings',
'/nodes/connect/method/quick-start',
].includes(location.pathname);
const goBack = () => {
history.goBack();
};
Expand Down Expand Up @@ -99,93 +104,95 @@ export default function NavBar() {
className="h-5 absolute left-0 right-0 ml-auto mr-auto"
src={srcUrlResolver(visorLogo)}
/>
{auth && (<DropdownMenu
onOpenChange={(value) => setMenuOpened(value)}
open={isMenuOpened}
>
<DropdownMenuTrigger asChild>
<Button size="icon" variant="ghost">
{!isMenuOpened ? (
<Menu className="h-4 w-4" />
) : (
<X className="h-4 w-4" />
)}
</Button>
</DropdownMenuTrigger>
<DropdownMenuPortal container={uiContainer?.rootElement}>
<DropdownMenuContent className="w-56">
<DropdownMenuLabel>
<FormattedMessage id="inbox.other"></FormattedMessage>
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.Inbox)}
>
<Inbox className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="inbox.other" />
</span>
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.CreateInbox)}
>
<MessageCircle className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="create-inbox" />
</span>
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.CreateJob)}
>
<Workflow className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="create-job" />
</span>
</DropdownMenuItem>
{auth && (
<DropdownMenu
onOpenChange={(value) => setMenuOpened(value)}
open={isMenuOpened}
>
<DropdownMenuTrigger asChild>
<Button size="icon" variant="ghost">
{!isMenuOpened ? (
<Menu className="h-4 w-4" />
) : (
<X className="h-4 w-4" />
)}
</Button>
</DropdownMenuTrigger>
<DropdownMenuPortal container={uiContainer?.rootElement}>
<DropdownMenuContent className="w-56">
<DropdownMenuLabel>
<FormattedMessage id="inbox.other"></FormattedMessage>
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.Inbox)}
>
<Inbox className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="inbox.other" />
</span>
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.CreateInbox)}
>
<MessageCircle className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="create-inbox" />
</span>
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.CreateJob)}
>
<Workflow className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="create-job" />
</span>
</DropdownMenuItem>

<DropdownMenuSeparator />
<DropdownMenuLabel>
<FormattedMessage id="agent.other"></FormattedMessage>
</DropdownMenuLabel>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.Agents)}
>
<Bot className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="agent.other" />
</span>
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.AddAgent)}
>
<Bot className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="add-agent" />
</span>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuLabel>
<FormattedMessage id="account.one"></FormattedMessage>
</DropdownMenuLabel>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.Settings)}
>
<Settings className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="setting.other" />
</span>
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.Logout)}
>
<LogOut className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="logout" />
</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenuPortal>
</DropdownMenu>)}
<DropdownMenuSeparator />
<DropdownMenuLabel>
<FormattedMessage id="agent.other"></FormattedMessage>
</DropdownMenuLabel>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.Agents)}
>
<Bot className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="agent.other" />
</span>
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.AddAgent)}
>
<Bot className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="add-agent" />
</span>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuLabel>
<FormattedMessage id="account.one"></FormattedMessage>
</DropdownMenuLabel>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.Settings)}
>
<Settings className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="setting.other" />
</span>
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => onClickMenuOption(MenuOption.Logout)}
>
<LogOut className="mr-2 h-4 w-4" />
<span>
<FormattedMessage id="logout" />
</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenuPortal>
</DropdownMenu>
)}
</div>
</nav>
);
Expand Down
10 changes: 3 additions & 7 deletions apps/shinkai-visor/src/components/popup/popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ import { useGlobalPopupChromeMessage } from '../../hooks/use-global-popup-chrome
import { langMessages, locale } from '../../lang/intl';
import { useAuth } from '../../store/auth/auth';
import { AddAgent } from '../add-agent/add-agent';
import { AddNode } from '../add-node/add-node';
import { Agents } from '../agents/agents';
import { AnimatedRoute } from '../animated-route/animated-routed';
import { ConnectMethodQrCode } from '../connect-method-qr-code/connec-method-qr-code';
import { ConnectMethodQuickStart } from '../connect-method-quick-start/connect-method-quick-start';
import { ConnectMethodRestoreConnection } from '../connect-method-restore-connection/connect-method-restore-connection';
import { ConnectSelectMethod } from '../connect-select-method/connect-select-method';
import { CreateInbox } from '../create-inbox/create-inbox';
import { CreateJob } from '../create-job/create-job';
import { ExportConnection } from '../export-connection/export-connection';
Expand Down Expand Up @@ -79,17 +78,14 @@ export const Popup = () => {
<Route path="/nodes">
<AnimatedRoute>
<Switch>
<Route path="/nodes/connect/select-method">
<ConnectSelectMethod></ConnectSelectMethod>
</Route>
<Route path="/nodes/connect/method/quick-start">
<ConnectMethodQuickStart></ConnectMethodQuickStart>
</Route>
<Route path="/nodes/connect/method/restore-connection">
<ConnectMethodRestoreConnection></ConnectMethodRestoreConnection>
</Route>
<Route path="/nodes/add">
<AddNode></AddNode>
<Route path="/nodes/connect/method/qr-code">
<ConnectMethodQrCode></ConnectMethodQrCode>
</Route>
</Switch>
</AnimatedRoute>
Expand Down

0 comments on commit 1c9834f

Please sign in to comment.