Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

wip: Temp removal of auth from desktop app

Richie McIlroyaf83f0da6254
diff --git a/apps/desktop/src-tauri/src/main.rs b/apps/desktop/src-tauri/src/main.rs
index 53c9aa7ec..3cdfeb4f9 100644
--- a/apps/desktop/src-tauri/src/main.rs
+++ b/apps/desktop/src-tauri/src/main.rs
@@ -71,21 +71,22 @@ fn main() {
let handle = app.handle();
let handle_clone = handle.clone();
- if let Some(camera_window) = app.get_window("camera") {
- let _ = camera_window.move_window(Position::BottomRight);
- }
-
- if let Some(options_window) = app.get_window("options") {
- let _ = options_window.move_window(Position::Center);
- }
-
tauri_plugin_deep_link::register(
"caprecorder",
move |request| {
dbg!(&request);
+ println!("Received request: {:?}", request);
handle_clone.emit_all("scheme-request-received", request).unwrap();
},
).unwrap();
+
+ if let Some(camera_window) = app.get_window("camera") {
+ let _ = camera_window.move_window(Position::BottomRight);
+ }
+
+ if let Some(options_window) = app.get_window("options") {
+ let _ = options_window.move_window(Position::Center);
+ }
let data_directory = handle.path_resolver().app_data_dir().unwrap_or_else(|| PathBuf::new());
let recording_state = RecordingState {
diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx
index 42005a63b..1b26bcfb5 100644
--- a/apps/desktop/src/App.tsx
+++ b/apps/desktop/src/App.tsx
@@ -1,13 +1,14 @@
+import { listen } from "@tauri-apps/api/event";
import "./App.css";
import { MediaDeviceProvider } from "@/utils/recording/MediaDeviceContext";
-import { AuthProvider } from "@/utils/database/AuthContext";
function App({ children }: { children: React.ReactNode }) {
- return (
- <AuthProvider>
- <MediaDeviceProvider>{children}</MediaDeviceProvider>
- </AuthProvider>
- );
+ return <MediaDeviceProvider>{children}</MediaDeviceProvider>;
}
+listen("scheme-request-received", ({ payload }) => {
+ console.log("scheme-request-received");
+ console.log(payload);
+});
+
export default App;
diff --git a/apps/desktop/src/components/windows/Options.tsx b/apps/desktop/src/components/windows/Options.tsx
index a4b313895..a5055b775 100644
--- a/apps/desktop/src/components/windows/Options.tsx
+++ b/apps/desktop/src/components/windows/Options.tsx
@@ -1,13 +1,13 @@
-import { Recorder } from "@/components/windows/inner/Recorder";
+// import { Recorder } from "@/components/windows/inner/Recorder";
import { SignIn } from "@/components/windows/inner/SignIn";
-import { useAuth } from "@/utils/database/AuthContext";
+// import { useAuth } from "@/utils/database/AuthContext";
export const Options = () => {
- const { session, userRef } = useAuth();
- const currentUser = userRef.current;
+ // const { session, userRef } = useAuth();
+ // const currentUser = userRef.current;
- if (currentUser) {
- return <Recorder session={session} />;
- }
+ // if (currentUser) {
+ // return <Recorder session={session} />;
+ // }
return <SignIn />;
};
diff --git a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
index 6e138574a..d095b575b 100644
--- a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
+++ b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
@@ -1,24 +1,24 @@
"use client";
import { usePathname, useRouter } from "next/navigation";
import {
- Plus,
+ // Plus,
Settings,
LogOut,
- ChevronDown,
+ // ChevronDown,
Clapperboard,
Bell,
History,
} from "lucide-react";
import Link from "next/link";
import { classNames } from "@/utils/helpers";
-import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
-} from "@cap/ui";
-import { Popover, PopoverContent, PopoverTrigger } from "@cap/ui";
+// import {
+// Command,
+// CommandEmpty,
+// CommandGroup,
+// CommandInput,
+// CommandItem,
+// } from "@cap/ui";
+// import { Popover, PopoverContent, PopoverTrigger } from "@cap/ui";
import { useState } from "react";
import {
Dialog,
@@ -26,10 +26,11 @@ import {
DialogDescription,
DialogHeader,
DialogTitle,
- DialogTrigger,
+ // DialogTrigger,
} from "@cap/ui";
import { NewSpace } from "@/components/forms/NewSpace";
-import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
+import { signOut } from "next-auth/react";
+// import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
// import { handleActiveSpace } from "@/utils/database/supabase/helpers";
// import { supabase } from "@/utils/database/supabase/client";
@@ -38,8 +39,8 @@ import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayou
export const AdminNavItems = () => {
const pathname = usePathname();
const router = useRouter();
- const [open, setOpen] = useState(false);
- const { spaceData, activeSpace } = useSharedContext();
+ // const [open, setOpen] = useState(false);
+ // const { spaceData, activeSpace } = useSharedContext();
const manageNavigation = [
{ name: "My Caps", href: `/dashboard/caps`, icon: Clapperboard },
@@ -49,21 +50,11 @@ export const AdminNavItems = () => {
];
const navItemClass =
- "flex items-center justify-start p-2 rounded-lg border border-transparent outline-none w-full";
-
- const handleLogout = async () => {
- // const { error } = await supabase.auth.signOut();
-
- router.refresh();
-
- // if (error) {
- // console.log({ error });
- // }
- };
+ "flex items-center justify-start p-2 rounded-lg outline-none w-full";
return (
<Dialog>
- <div className="embossed mt-8 mb-4 w-full max-w-full">
+ {/* <div className="embossed mt-8 mb-4 w-full max-w-full">
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<div
@@ -74,7 +65,7 @@ export const AdminNavItems = () => {
<div className="flex items-center w-full text-left">
<div>
<p className="text-sm">Spaces</p>
- <p className="font-medium">
+ <p className="font-medium text-sm">
{activeSpace?.name ?? "No space found"}
</p>
</div>
@@ -89,7 +80,7 @@ export const AdminNavItems = () => {
<CommandInput placeholder="Search spaces..." />
<CommandEmpty>No spaces found.</CommandEmpty>
<CommandGroup>
- {/* {spaceData?.map((space) => (
+ {spaceData?.map((space) => (
<CommandItem
key={space.name}
onSelect={async () => {
@@ -100,7 +91,7 @@ export const AdminNavItems = () => {
>
{space.name}
</CommandItem>
- ))} */}
+ ))}
<DialogTrigger className="w-full">
<CommandItem className="bg-filler aria-selected:bg-filler-2 rounded-lg">
<Plus className="w-4 h-auto mr-1" />
@@ -111,9 +102,9 @@ export const AdminNavItems = () => {
</Command>
</PopoverContent>
</Popover>
- </div>
+ </div> */}
<nav
- className="w-full flex flex-col justify-between h-full"
+ className="w-full mt-8 flex flex-col justify-between h-full"
aria-label="Sidebar"
>
<div className="space-y-1">
@@ -125,8 +116,8 @@ export const AdminNavItems = () => {
href={item.href}
className={classNames(
pathname == item.href
- ? "bg-gradient-to-l from-tertiary-3 to-tertiary-2 border-tertiary-2"
- : "opacity-75 hover:opacity-100 border-transparent",
+ ? "bg-gradient-to-l from-tertiary to-tertiary-3"
+ : "opacity-75 hover:opacity-100",
navItemClass
)}
>
@@ -140,7 +131,7 @@ export const AdminNavItems = () => {
</div>
<div className="mt-auto">
<button
- onClick={handleLogout}
+ onClick={() => signOut()}
className={classNames("hover:opacity-75", navItemClass)}
>
<LogOut className="flex-shrink-0 w-6 h-6" aria-hidden="true" />
diff --git a/apps/web/app/dashboard/caps/Caps.tsx b/apps/web/app/dashboard/caps/Caps.tsx
index f21692425..11052d32b 100644
--- a/apps/web/app/dashboard/caps/Caps.tsx
+++ b/apps/web/app/dashboard/caps/Caps.tsx
@@ -20,12 +20,19 @@ export const Caps = ({
</div>
<div className="text-center">
<h2 className="text-2xl font-semibold mb-3">
- Record your first cap.
+ Record your first Cap.
</h2>
<p className="text-xl max-w-md">
Craft your narrative with a Cap—get projects done quicker.
</p>
- <Button size="lg" className="mt-8" variant="default">
+ <Button
+ onClick={() => {
+ window.open("caprecorder://");
+ }}
+ size="lg"
+ className="mt-8"
+ variant="default"
+ >
Record a Cap
</Button>
</div>