Skip to content

Commit

Permalink
feat:新增 r2 bucket管理模块
Browse files Browse the repository at this point in the history
  • Loading branch information
jweboy committed Apr 22, 2024
1 parent ae93d85 commit 4bf35e6
Show file tree
Hide file tree
Showing 13 changed files with 754 additions and 13 deletions.
5 changes: 3 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# NEXT_PUBLIC_API_URL=http://127.0.0.1:4000
NEXT_PUBLIC_API_URL=https://nest-api-service.vercel.app
NEXT_PUBLIC_API_URL=http://127.0.0.1:4000
# NEXT_PUBLIC_API_URL=https://nest-api-service.vercel.app
NEXT_PUBLIC_CLOUDFARE_R2_URL=https://resource.jweboy.asia/
3 changes: 2 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
NEXT_PUBLIC_API_URL=https://nest-api-service.vercel.app
NEXT_PUBLIC_API_URL=https://nest-api-service.vercel.app
NEXT_PUBLIC_CLOUDFARE_R2_URL=https://resource.jweboy.asia/
41 changes: 35 additions & 6 deletions app/dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Link from "next/link";
import {
Coins,
File,
FilesIcon,
Home,
LineChart,
ListFilter,
Expand All @@ -17,6 +18,7 @@ import {
Settings,
ShoppingCart,
Users2,
Video,
} from "lucide-react";

import { Badge } from "@/components/ui/badge";
Expand Down Expand Up @@ -70,12 +72,15 @@ function Dashboard({ children }: BaseComponentProps) {
<SWRConfig
value={{
fetcher: (resource, init) => {
return fetch(process.env.NEXT_PUBLIC_API_URL + resource, init).then(
async (res) => {
const data = await res.json();
return data?.data;
}
);
return fetch(
/(http|https):\/\/\S*/.test(process.env.NEXT_PUBLIC_API_URL)
? resource
: process.env.NEXT_PUBLIC_API_URL + resource,
init
).then(async (res) => {
const data = await res.json();
return data?.data;
});
},
}}
>
Expand Down Expand Up @@ -126,6 +131,18 @@ function Dashboard({ children }: BaseComponentProps) {
</TooltipTrigger>
<TooltipContent side="right">Product</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Link
href="/dashboard/r2"
className="flex h-9 w-9 items-center justify-center rounded-lg bg-accent text-accent-foreground transition-colors hover:text-foreground md:h-8 md:w-8"
>
<FilesIcon className="h-5 w-5" />
<span className="sr-only">R2</span>
</Link>
</TooltipTrigger>
<TooltipContent side="right">R2</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Link
Expand All @@ -138,6 +155,18 @@ function Dashboard({ children }: BaseComponentProps) {
</TooltipTrigger>
<TooltipContent side="right">Cropto token</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Link
href="/dashboard/media"
className="flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8"
>
<Video className="h-5 w-5" />
<span className="sr-only">Media</span>
</Link>
</TooltipTrigger>
<TooltipContent side="right">Media editor</TooltipContent>
</Tooltip>
</nav>
<nav className="mt-auto flex flex-col items-center gap-4 px-2 py-4">
<Tooltip>
Expand Down
Binary file not shown.
Binary file added app/dashboard/media/16516645.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4bf35e6

Please sign in to comment.