Skip to content

Commit

Permalink
fix: UI improvements (#418)
Browse files Browse the repository at this point in the history
* fix: rearrange sidebar menu

* fix: device warning dismiss

* fix: device compatibility

* bump shinkai app version
  • Loading branch information
paulclindo authored Sep 3, 2024
1 parent 1fe84fe commit 8f81743
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 17 deletions.
2 changes: 1 addition & 1 deletion apps/shinkai-desktop/src-tauri/src/hardware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn hardware_get_summary() -> HardwareSummary {
let cpus = sys.cpus().len();

let requirement_status;
if cpus >= RECOMMENDED_CPUS && memory >= RECOMMENDED_MEMORY && (discrete_gpu || is_macos) {
if is_macos || (cpus >= RECOMMENDED_CPUS && memory >= RECOMMENDED_MEMORY && discrete_gpu) {
requirement_status = RequirementsStatus::Optimal;
} else if cpus >= RECOMMENDED_CPUS && memory >= RECOMMENDED_MEMORY {
requirement_status = RequirementsStatus::Recommended;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@shinkai_network/shinkai-ui';
import { cn } from '@shinkai_network/shinkai-ui/utils';
import { AnimatePresence, motion } from 'framer-motion';
import { AlertTriangle } from 'lucide-react';
import { AlertTriangle, XIcon } from 'lucide-react';

import {
RequirementsStatus,
Expand All @@ -28,6 +28,12 @@ export const ResourcesBanner = ({
}) => {
const { isSuccess, data: hardwareSummary } = useHardwareGetSummaryQuery();
const sidebarExpanded = useSettings((state) => state.sidebarExpanded);
const compatibilityBannerDismissed = useSettings(
(state) => state.compatibilityBannerDismissed,
);
const setCompatibilityBannerDismissed = useSettings(
(state) => state.setCompatibilityBannerDismissed,
);

const isOptimal =
hardwareSummary?.requirements_status === RequirementsStatus.Optimal;
Expand All @@ -40,7 +46,7 @@ export const ResourcesBanner = ({
hardwareSummary?.requirements_status === RequirementsStatus.Minimum;

const alertContent = (
<Alert className="shadow-lg" variant="warning">
<Alert className="relative shadow-lg" variant="warning">
<AlertTriangle className="h-4 w-4" />
<AlertTitle className="text-sm font-medium">
Device Compatibility
Expand Down Expand Up @@ -85,9 +91,16 @@ export const ResourcesBanner = ({
</div> */}
</div>
</AlertDescription>
<button
className="absolute right-2 top-2 z-[100] text-gray-500 hover:text-gray-700"
onClick={() => setCompatibilityBannerDismissed(true)}
type="button"
>
<XIcon className="h-4 w-4 text-yellow-200" />
</button>
</Alert>
);
if (isInSidebar && !isOptimal) {
if (isInSidebar && !isOptimal && !compatibilityBannerDismissed) {
return (
<div className={cn('flex w-full flex-col text-xs', className)}>
<TooltipProvider delayDuration={0}>
Expand Down Expand Up @@ -132,6 +145,10 @@ export const ResourcesBanner = ({
);
}

if (compatibilityBannerDismissed) {
return null;
}

return (
<div className={cn('flex w-full flex-col text-xs', className)}>
{isSuccess && !isOptimal && alertContent}
Expand Down
2 changes: 1 addition & 1 deletion apps/shinkai-desktop/src/pages/get-started.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const GetStartedPage = () => {
{/* or*/}
{/* </span>*/}
{/*</Separator>*/}
{!config.isDev && (
{config.isDev && (
<div className="space-y-4">
{/* Disable Shinkai Hosting */}
{/*<a*/}
Expand Down
16 changes: 8 additions & 8 deletions apps/shinkai-desktop/src/pages/layout/main-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from '@shinkai_network/shinkai-ui';
import {
AISearchContentIcon,
AiTasksIcon,
// AiTasksIcon,
BrowseSubscriptionIcon,
CreateAIIcon,
FilesIcon,
Expand Down Expand Up @@ -242,12 +242,12 @@ export function MainNav() {
href: '/inboxes',
icon: <InboxIcon className="h-5 w-5" />,
},
{
title: t('layout.menuItems.aiTasks'),
href: '/ai-tasks',
icon: <AiTasksIcon className="h-5 w-5" />,
disabled: true,
},
// {
// title: t('layout.menuItems.aiTasks'),
// href: '/ai-tasks',
// icon: <AiTasksIcon className="h-5 w-5" />,
// disabled: true,
// },
// auth?.shinkai_identity.includes('localhost') && {
// title: 'Create DM Chat',
// href: '/create-chat',
Expand Down Expand Up @@ -436,7 +436,7 @@ export function MainNav() {
</TooltipPortal>
</Tooltip>
</TooltipProvider>
{(item.href === '/ai-tasks' ||
{(item.href === '/my-subscriptions' ||
item.href === '/vector-search') && (
<Separator className="my-0.5 w-full bg-gray-200" />
)}
Expand Down
12 changes: 11 additions & 1 deletion apps/shinkai-desktop/src/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type SettingsStore = {
setEvmAddress: (evmAddress: string) => void;
heightRow: 'small' | 'medium' | 'large' | 'extra-large';
setHeightRow: (height: 'small' | 'medium' | 'large' | 'extra-large') => void;
compatibilityBannerDismissed: boolean;
setCompatibilityBannerDismissed: (dismissed: boolean) => void;
};

export const useSettings = create<SettingsStore>()(
Expand Down Expand Up @@ -78,6 +80,11 @@ export const useSettings = create<SettingsStore>()(
setHeightRow: (heightRow) => {
set({ heightRow });
},

compatibilityBannerDismissed: false,
setCompatibilityBannerDismissed: (dismissed) => {
set({ compatibilityBannerDismissed: dismissed });
},
}),
{
name: 'settings',
Expand All @@ -90,7 +97,10 @@ useAuth.subscribe((state, prevState) => {
handleAuthSideEffect(state.auth, prevState.auth);
});

const handleAuthSideEffect = async (auth: SetupData | null, prevAuth: SetupData | null) => {
const handleAuthSideEffect = async (
auth: SetupData | null,
prevAuth: SetupData | null,
) => {
// SignOut case
if (prevAuth && !auth) {
useSettings.getState().setDefaultAgentId('');
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shinkai/source",
"version": "0.7.36",
"version": "0.7.37",
"license": "SEE LICENSE IN LICENSE",
"files": [
"LICENSE"
Expand Down

0 comments on commit 8f81743

Please sign in to comment.