@@ -123,10 +133,12 @@ interface HeaderProps {
orgName: string
redirect?: boolean
onDownload: (name: string, code: string) => void
+ onCopy: (code: string) => void
+ onCopyCurl: () => void
onOpenPlainText?: (gistID: string) => void
}
-function Header({ gist, orgName, redirect, onDownload, onOpenPlainText }: HeaderProps) {
+function Header({ gist, orgName, redirect, onDownload, onCopy, onCopyCurl, onOpenPlainText }: HeaderProps) {
return (
@@ -145,31 +157,55 @@ function Header({ gist, orgName, redirect, onDownload, onOpenPlainText }: Header
-
+
+
+
+
+
+
+
+
+
+
+
{onOpenPlainText && (
-
+
- onOpenPlainText(gist.id)}
- icon={}
- variant={"header"}
>
- Raw
-
+
+
)}
-
+
- onDownload(gist.name, gist.code)}
- icon={}
- variant={"header"}
>
- Download
-
+
+
diff --git a/src/components/ui/menu-button.tsx b/src/components/ui/menu-button.tsx
index 291c0ec..3aeb02a 100644
--- a/src/components/ui/menu-button.tsx
+++ b/src/components/ui/menu-button.tsx
@@ -26,7 +26,7 @@ const MenuButton = React.forwardRef
(
{icon &&
React.cloneElement(icon, {
- className: "h-4 w-4 text-slate-500 group-hover:text-primary-foreground",
+ className: "h-4 w-4 text-slate-500 group-hover:text-primary-foreground tranition-all",
})}
{children}
diff --git a/src/lib/queries/auth.queries.tsx b/src/lib/queries/auth.queries.tsx
index 5b4177e..7934eb3 100644
--- a/src/lib/queries/auth.queries.tsx
+++ b/src/lib/queries/auth.queries.tsx
@@ -2,7 +2,6 @@
import ky from "ky"
import { getBackendURL } from "../utils"
import { useMutation, useQueryClient } from "@tanstack/react-query"
-import getQueryClient from "./queries"
const fetchLocalAuth = async ({ email }: { email: string }) => {
const json = await ky
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 9e95e94..2da1e49 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -8,3 +8,11 @@ export function cn(...inputs: ClassValue[]) {
export function getBackendURL() {
return process.env.NEXT_PUBLIC_BACKEND_URL || "https://api.gists.app"
}
+
+export function getRawGistURL(id: string) {
+ if (process.env.NODE_ENV === "production") {
+ const raw_url = getBackendURL().replace("api", "raw") + "/" + id
+ return raw_url
+ }
+ return getBackendURL() + "/gists/raw/" + id
+}