Skip to content

Commit

Permalink
refactor: move pipe store to hamburger menu, add timeline, remove dea…
Browse files Browse the repository at this point in the history
…d code,
  • Loading branch information
louis030195 committed Nov 9, 2024
1 parent e2a2ba3 commit d5e6a23
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 27 deletions.
50 changes: 47 additions & 3 deletions screenpipe-app-tauri/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,21 @@ import localforage from "localforage";
import { useHealthCheck } from "@/lib/hooks/use-health-check";
import { Skeleton } from "@/components/ui/skeleton";
import { useChangelogDialog } from "@/lib/hooks/use-changelog-dialog";


import { useSettings } from "@/lib/hooks/use-settings";
import { invoke } from "@tauri-apps/api/core";
import { Clock } from "lucide-react";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";

export default function Header() {
const [showInbox, setShowInbox] = useState(false);
const [messages, setMessages] = useState<Message[]>([]);
const { health } = useHealthCheck();
const { settings } = useSettings();

const isLoading = !health;

Expand Down Expand Up @@ -92,6 +100,10 @@ export default function Header() {
const { setShowOnboarding } = useOnboarding();
const { setShowChangelogDialog } = useChangelogDialog();

const handleShowTimeline = async () => {
await invoke("show_timeline");
};

return (
<div>
{isLoading ? (
Expand All @@ -105,8 +117,34 @@ export default function Header() {
</div>
<div className="flex space-x-4 absolute top-4 right-4">
<HealthStatus className="mt-3 cursor-pointer" />
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<div>
<Button
variant="ghost"
size="sm"
className="cursor-pointer"
onClick={handleShowTimeline}
disabled={
!settings.enableFrameCache ||
!health ||
health.status === "error"
}
>
<Clock className="mr-2 h-4 w-4" />
timeline
</Button>
</div>
</TooltipTrigger>
{!settings.enableFrameCache && (
<TooltipContent>
<p>enable timeline in settings first</p>
</TooltipContent>
)}
</Tooltip>
</TooltipProvider>
<MeetingHistory />
<PipeDialog />
<Settings />

<Button
Expand All @@ -126,6 +164,12 @@ export default function Header() {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="mr-4" align="end">
<DropdownMenuItem
className="cursor-pointer"
onClick={(e) => e.preventDefault()}
>
<PipeDialog />
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"
onClick={() =>
Expand Down
2 changes: 1 addition & 1 deletion screenpipe-app-tauri/components/pipe-store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ const PipeDialog: React.FC = () => {
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="ghost">
<Button variant="ghost" className="h-[20px] px-0 py-0">
<Puzzle className="mr-2 h-4 w-4" />
pipe store
</Button>
Expand Down
22 changes: 1 addition & 21 deletions screenpipe-app-tauri/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,17 +317,6 @@ export function Settings({ className }: { className?: string }) {
});
};

const handleAiUrlChange = (newValue: string) => {
if (newValue === "custom") {
setLocalSettings({ ...localSettings, aiUrl: "" });
} else if (newValue === "embedded") {
setLocalSettings({ ...localSettings, aiUrl: "embedded" });
} else {
setLocalSettings({ ...localSettings, aiUrl: newValue });
}
updateSettings({ aiUrl: newValue });
};

const isApiKeyRequired =
localSettings.aiUrl !== "https://ai-proxy.i-f9f.workers.dev/v1" &&
localSettings.aiUrl !== "http://localhost:11434/v1" &&
Expand Down Expand Up @@ -457,15 +446,6 @@ export function Settings({ className }: { className?: string }) {
"embedded",
].includes(localSettings.aiUrl);

const getSelectValue = () => {
if (isCustomUrl) return "custom";
if (localSettings.aiUrl === "embedded" && embeddedAIStatus !== "running") {
// Fallback to a default option if embedded AI is selected but not running
return "https://ai-proxy.i-f9f.workers.dev/v1";
}
return localSettings.aiUrl;
};

// Add this function to check the embedded AI status
const checkEmbeddedAIStatus = useCallback(async () => {
if (localSettings.embeddedLLM.enabled) {
Expand Down Expand Up @@ -498,7 +478,7 @@ export function Settings({ className }: { className?: string }) {
onOpenChange={(open) => {
if (!open) {
// hack bcs something does not update settings for some reason
window.location.reload();
window.location.reload(); // TODO: event trigger
}
}}
>
Expand Down
2 changes: 1 addition & 1 deletion screenpipe-app-tauri/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "screenpipe-app",
"private": true,
"scripts": {
"dev": "bun tauri dev",
"dev": "next dev",
"build": "next build",
"prebuild": "bun scripts/pre_build.js",
"tauri": "tauri",
Expand Down
2 changes: 1 addition & 1 deletion screenpipe-app-tauri/src-tauri/Cargo.lock

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

0 comments on commit d5e6a23

Please sign in to comment.