mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat(dokploy): add welcome modal to dokploy cloud
This commit is contained in:
@@ -34,7 +34,7 @@ export const ShowRequests = () => {
|
|||||||
<Card className="bg-transparent mt-10">
|
<Card className="bg-transparent mt-10">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>Request Distribution</CardTitle>
|
<CardTitle>Request Distribution</CardTitle>
|
||||||
<div className="flex justify-between gap-2">
|
<div className="flex max-sm:flex-wrap justify-between gap-2">
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
<span>Showing web and API requests over time</span>
|
<span>Showing web and API requests over time</span>
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { NumberInput } from "@/components/ui/input";
|
import { NumberInput } from "@/components/ui/input";
|
||||||
import { Progress } from "@/components/ui/progress";
|
import { Progress } from "@/components/ui/progress";
|
||||||
@@ -148,6 +149,11 @@ export const ShowBilling = () => {
|
|||||||
: "lg:py-8",
|
: "lg:py-8",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
{isAnnual && (
|
||||||
|
<div className="mb-4 flex flex-row items-center gap-2">
|
||||||
|
<Badge>Recommended 🚀</Badge>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{isAnnual ? (
|
{isAnnual ? (
|
||||||
<div className="flex flex-row gap-2 items-center">
|
<div className="flex flex-row gap-2 items-center">
|
||||||
<p className=" text-2xl font-semibold tracking-tight text-primary ">
|
<p className=" text-2xl font-semibold tracking-tight text-primary ">
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import { ShowBilling } from "@/components/dashboard/settings/billing/show-billing";
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
} from "@/components/ui/dialog";
|
||||||
|
import { api } from "@/utils/api";
|
||||||
|
import type React from "react";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
export const ShowWelcomeDokploy = () => {
|
||||||
|
const { data } = api.auth.get.useQuery();
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
const { data: isCloud, isLoading } = api.settings.isCloud.useQuery();
|
||||||
|
|
||||||
|
if (!isCloud || data?.rol !== "admin") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
!isLoading &&
|
||||||
|
isCloud &&
|
||||||
|
!localStorage.getItem("hasSeenCloudWelcomeModal") &&
|
||||||
|
data?.rol === "admin"
|
||||||
|
) {
|
||||||
|
setOpen(true);
|
||||||
|
}
|
||||||
|
}, [isCloud, isLoading]);
|
||||||
|
|
||||||
|
const handleClose = (isOpen: boolean) => {
|
||||||
|
if (data?.rol === "admin") {
|
||||||
|
setOpen(isOpen);
|
||||||
|
if (!isOpen) {
|
||||||
|
localStorage.setItem("hasSeenCloudWelcomeModal", "true"); // Establece el flag al cerrar el modal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Dialog open={open} onOpenChange={handleClose}>
|
||||||
|
<DialogContent className="sm:max-w-xl max-h-screen overflow-y-auto">
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle className="text-2xl font-semibold text-center">
|
||||||
|
Welcome to Dokploy Cloud 🎉
|
||||||
|
</DialogTitle>
|
||||||
|
<p className="text-center text-sm text-muted-foreground mt-2">
|
||||||
|
Unlock powerful features to streamline your deployments and manage
|
||||||
|
projects effortlessly.
|
||||||
|
</p>
|
||||||
|
</DialogHeader>
|
||||||
|
<div className="mt-4 space-y-3 text-sm text-primary ">
|
||||||
|
<ShowBilling />
|
||||||
|
</div>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -19,6 +19,7 @@ import { buttonVariants } from "../ui/button";
|
|||||||
export const Navbar = () => {
|
export const Navbar = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { data } = api.auth.get.useQuery();
|
const { data } = api.auth.get.useQuery();
|
||||||
|
const { data: isCloud } = api.settings.isCloud.useQuery();
|
||||||
const { data: user } = api.user.byAuthId.useQuery(
|
const { data: user } = api.user.byAuthId.useQuery(
|
||||||
{
|
{
|
||||||
authId: data?.id || "",
|
authId: data?.id || "",
|
||||||
@@ -130,6 +131,16 @@ export const Navbar = () => {
|
|||||||
Settings
|
Settings
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuGroup>
|
</DropdownMenuGroup>
|
||||||
|
{isCloud && data?.rol === "admin" && (
|
||||||
|
<DropdownMenuItem
|
||||||
|
className="cursor-pointer"
|
||||||
|
onClick={() => {
|
||||||
|
router.push("/dashboard/settings/billing");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Billing
|
||||||
|
</DropdownMenuItem>
|
||||||
|
)}
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
className="cursor-pointer"
|
className="cursor-pointer"
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export const NavigationTabs = ({ tab, children }: Props) => {
|
|||||||
router.push(tab?.index || "");
|
router.push(tab?.index || "");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="flex flex-row items-center justify-between w-full gap-4 max-sm:overflow-x-auto border-b border-b-divider pb-1">
|
<div className="flex flex-row items-center justify-between w-full gap-4 max-sm:overflow-x-auto overflow-y-hidden border-b border-b-divider pb-1">
|
||||||
<TabsList className="bg-transparent relative px-0">
|
<TabsList className="bg-transparent relative px-0">
|
||||||
{tabMap.map((tab, index) => {
|
{tabMap.map((tab, index) => {
|
||||||
if (tab?.isShow && !tab?.isShow?.({ rol: data?.rol, user })) {
|
if (tab?.isShow && !tab?.isShow?.({ rol: data?.rol, user })) {
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
import { ShowProjects } from "@/components/dashboard/projects/show";
|
import { ShowProjects } from "@/components/dashboard/projects/show";
|
||||||
|
import { ShowWelcomeDokploy } from "@/components/dashboard/settings/billing/show-welcome-dokploy";
|
||||||
import { DashboardLayout } from "@/components/layouts/dashboard-layout";
|
import { DashboardLayout } from "@/components/layouts/dashboard-layout";
|
||||||
import { appRouter } from "@/server/api/root";
|
import { appRouter } from "@/server/api/root";
|
||||||
import { validateRequest } from "@dokploy/server";
|
import { validateRequest } from "@dokploy/server";
|
||||||
import { createServerSideHelpers } from "@trpc/react-query/server";
|
import { createServerSideHelpers } from "@trpc/react-query/server";
|
||||||
import type { GetServerSidePropsContext } from "next";
|
import type { GetServerSidePropsContext } from "next";
|
||||||
import React, { type ReactElement } from "react";
|
import type React from "react";
|
||||||
|
import type { ReactElement } from "react";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
|
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
return <ShowProjects />;
|
return (
|
||||||
|
<>
|
||||||
|
<ShowWelcomeDokploy />
|
||||||
|
<ShowProjects />
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Dashboard;
|
export default Dashboard;
|
||||||
@@ -35,7 +42,7 @@ export async function getServerSideProps(
|
|||||||
});
|
});
|
||||||
|
|
||||||
await helpers.settings.isCloud.prefetch();
|
await helpers.settings.isCloud.prefetch();
|
||||||
|
await helpers.auth.get.prefetch();
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
|
|||||||
Reference in New Issue
Block a user