Skip to content

Commit

Permalink
Merge branch 'main' into fix/v1_permissions_createRole_transaction_error
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo4604 authored Oct 10, 2024
2 parents 41ca6b9 + c948512 commit 2539db5
Show file tree
Hide file tree
Showing 108 changed files with 1,186 additions and 908 deletions.
2 changes: 1 addition & 1 deletion apps/billing/src/lib/db-marketing/schemas/searchQuery.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { relations, sql } from "drizzle-orm";
import { relations } from "drizzle-orm";
import {
boolean,
index,
Expand Down
3 changes: 0 additions & 3 deletions apps/billing/src/lib/db-marketing/schemas/serper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { db } from "@/lib/db-marketing/client";
import type * as serper from "@/lib/serper";
import { relations } from "drizzle-orm";
import { eq } from "drizzle-orm";
import { index, int, json, mysqlTable, text, timestamp, varchar } from "drizzle-orm/mysql-core";
import { createSelectSchema } from "drizzle-zod";
import type { z } from "zod";
Expand Down
1 change: 0 additions & 1 deletion apps/billing/src/lib/tinybird.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Tinybird as Client } from "@chronark/zod-bird";
import { newId } from "@unkey/id";
import { z } from "zod";

export class Tinybird {
Expand Down
4 changes: 1 addition & 3 deletions apps/billing/src/trigger/downgrade-requests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { connectDatabase, eq, schema } from "@/lib/db";
import { env } from "@/lib/env";
import { eventTrigger } from "@trigger.dev/sdk";
import { logger, task } from "@trigger.dev/sdk/v3";
import { task } from "@trigger.dev/sdk/v3";

export const downgradeTask = task({
id: "billing_downgrade",
Expand Down
1 change: 0 additions & 1 deletion apps/billing/src/trigger/invoicing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { logger, schedules } from "@trigger.dev/sdk/v3";

import { connectDatabase } from "@/lib/db";

import Stripe from "stripe";
import { createInvoiceTask } from "./create-invoice";
import { downgradeTask } from "./downgrade-requests";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from "@/components/ui/breadcrumb";

import { BreadcrumbSkeleton } from "@/components/dashboard/breadcrumb-skeleton";
import { getTenantId } from "@/lib/auth";
import { db } from "@/lib/db";
import { unstable_cache as cache } from "next/cache";
import { Suspense } from "react";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from "@/components/ui/breadcrumb";

import { BreadcrumbSkeleton } from "@/components/dashboard/breadcrumb-skeleton";
import { getTenantId } from "@/lib/auth";
import { db } from "@/lib/db";
import { unstable_cache as cache } from "next/cache";
import { Suspense } from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
Expand Down
3 changes: 0 additions & 3 deletions apps/dashboard/app/(app)/@breadcrumb/identities/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { Badge } from "@/components/ui/badge";
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb";

export const dynamic = "force-dynamic";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { toast } from "@/components/ui/toaster";
import { trpc } from "@/lib/trpc/client";
import { cn } from "@/lib/utils";
import { zodResolver } from "@hookform/resolvers/zod";
import type { Key } from "@unkey/db";
import { useRouter } from "next/navigation";
import { useForm } from "react-hook-form";
import { z } from "zod";
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/app/(app)/apis/client.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use client";
import { EmptyPlaceholder } from "@/components/dashboard/empty-placeholder";
import { PageHeader } from "@/components/dashboard/page-header";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";
Expand Down
4 changes: 0 additions & 4 deletions apps/dashboard/app/(app)/authorization/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import type * as React from "react";

import { Banner } from "@/components/banner";
import { Navbar } from "@/components/dashboard/navbar";
import { PageHeader } from "@/components/dashboard/page-header";
import { OptIn } from "@/components/opt-in";
import { getTenantId } from "@/lib/auth";
import { db } from "@/lib/db";
import Link from "next/link";
import { redirect } from "next/navigation";

export const dynamic = "force-dynamic";
Expand Down
4 changes: 0 additions & 4 deletions apps/dashboard/app/(app)/identities/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import type * as React from "react";

import { Banner } from "@/components/banner";
import { Navbar } from "@/components/dashboard/navbar";
import { PageHeader } from "@/components/dashboard/page-header";
import { OptIn } from "@/components/opt-in";
import { getTenantId } from "@/lib/auth";
import { db } from "@/lib/db";
import Link from "next/link";
import { redirect } from "next/navigation";

export const dynamic = "force-dynamic";
Expand Down
12 changes: 2 additions & 10 deletions apps/dashboard/app/(app)/identities/page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import { redirect } from "next/navigation";

import { EmptyPlaceholder } from "@/components/dashboard/empty-placeholder";
import {
Table,
TableBody,
TableCell,
TableFooter,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { Table, TableBody, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { getTenantId } from "@/lib/auth";
import { db } from "@/lib/db";
import { Loader2, Scan } from "lucide-react";
import { Loader2 } from "lucide-react";
import { unstable_cache as cache } from "next/cache";
import { parseAsInteger, parseAsString } from "nuqs/server";
import { Suspense } from "react";
Expand Down
15 changes: 9 additions & 6 deletions apps/dashboard/app/(app)/mobile-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Menu } from "lucide-react";
import Link from "next/link";
import { useSelectedLayoutSegments } from "next/navigation";
import { WorkspaceSwitcher } from "./team-switcher";
import { UserButton } from "./user-button";

type Props = {
className?: string;
Expand All @@ -23,17 +24,19 @@ type Props = {

export const MobileSideBar = ({ className, workspace }: Props) => {
const segments = useSelectedLayoutSegments() ?? [];

const workspaceNavigation = createWorkspaceNavigation(workspace, segments);

return (
<div className={cn(className, "w-96")}>
<div className={cn(className, "w-full")}>
<Sheet>
<div className="flex items-center justify-between w-full p-4 gap-6">
<SheetTrigger>
<Menu className="w-6 h-6 " />
</SheetTrigger>
<WorkspaceSwitcher />
<div className={cn(className, "w-96 flex items-center justify-between py-4 gap-6")}>
<SheetTrigger>
<Menu className="w-6 h-6 " />
</SheetTrigger>
<WorkspaceSwitcher />
</div>
<UserButton />
</div>
<SheetHeader>
<SheetClose />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
"use client";
import { Loading } from "@/components/dashboard/loading";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import {
Form,
FormControl,
Expand All @@ -33,7 +24,6 @@ import { trpc } from "@/lib/trpc/client";
import { zodResolver } from "@hookform/resolvers/zod";
import { useRouter } from "next/navigation";
import type React from "react";
import { useState } from "react";
import { useForm } from "react-hook-form";
import { z } from "zod";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Button } from "@/components/ui/button";
import { getTenantId } from "@/lib/auth";
import { db } from "@/lib/db";
import { getAllSemanticCacheLogs } from "@/lib/tinybird";
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/app/(app)/semantic-cache/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { PageHeader } from "@/components/dashboard/page-header";
import { getTenantId } from "@/lib/auth";
import { db } from "@/lib/db";
import { redirect } from "next/navigation";
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/app/(app)/settings/billing/plans/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { db } from "@/lib/db";
import { ArrowLeft } from "lucide-react";
import Link from "next/link";
import { notFound } from "next/navigation";
import React from "react";
import { ChangePlanButton } from "./button";

const tiers = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"use client";

import { CopyButton } from "@/components/dashboard/copy-button";
import { Checkbox } from "@/components/ui/checkbox";
import { Label } from "@/components/ui/label";
import { toast } from "@/components/ui/toaster";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { trpc } from "@/lib/trpc/client";
import { Loader2 } from "lucide-react";
import { useRouter } from "next/navigation";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const UpdateUserName: React.FC = () => {
user
.update({ username })
.then(() => {
toast.success("Workspace name updated");
toast.success("Username updated");
user.reload();
})
.catch((err) => {
Expand Down
33 changes: 26 additions & 7 deletions apps/dashboard/app/(app)/user-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Book, ChevronRight, LogOut, Rocket, Settings } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import type React from "react";

export const UserButton: React.FC = () => {
const { user } = useUser();
const router = useRouter();
Expand All @@ -25,17 +26,35 @@ export const UserButton: React.FC = () => {

return (
<DropdownMenu>
<DropdownMenuTrigger className="flex items-center justify-between gap-2 p-2 w-full h-12 rounded-[0.625rem] hover:bg-background-subtle hover:cursor-pointer text-content">
<div className="flex items-center gap-2 whitespace-nowrap overflow-hidden">
<Avatar className="w-5 h-5">
<DropdownMenuTrigger className="flex items-center justify-between gap-2 p-2 w-auto lg:w-full h-12 rounded-lg hover:bg-background-subtle hover:cursor-pointer text-content ">
<div className="flex items-center gap-2 overflow-hidden whitespace-nowrap">
<Tooltip>
<TooltipTrigger
className="w-full overflow-hidden text-ellipsis hidden sm:inline lg:hidden"
asChild
>
<span className="overflow-hidden text-ellipsis text-sm font-medium">
{user.username ?? user.fullName ?? user.primaryEmailAddress?.emailAddress}
</span>
</TooltipTrigger>
<TooltipContent>
<span className="text-sm font-medium">
{user.username ?? user.fullName ?? user.primaryEmailAddress?.emailAddress}
</span>
</TooltipContent>
</Tooltip>
<Avatar className="w-8 h-8 lg:w-5 lg:h-5">
{user.imageUrl ? <AvatarImage src={user.imageUrl} alt="Profile picture" /> : null}
<AvatarFallback className=" w-5 h-5 overflow-hidden text-gray-700 bg-gray-100 border border-gray-500 rounded-md">
<AvatarFallback className="w-8 h-8 lg:w-5 lg:h-5 bg-gray-100 border border-gray-500 rounded-md">
{(user?.fullName ?? "U").slice(0, 2).toUpperCase()}
</AvatarFallback>
</Avatar>

<Tooltip>
<TooltipTrigger asChild>
<TooltipTrigger
className="hidden lg:inline w-full overflow-hidden text-ellipsis"
asChild
>
<span className="overflow-hidden text-ellipsis text-sm font-medium">
{user.username ?? user.fullName ?? user.primaryEmailAddress?.emailAddress}
</span>
Expand All @@ -47,9 +66,9 @@ export const UserButton: React.FC = () => {
</TooltipContent>
</Tooltip>
</div>
<ChevronRight className="w-4 h-4" />
<ChevronRight className="hidden lg:inline w-4 h-4" />
</DropdownMenuTrigger>
<DropdownMenuContent side="right" className="w-96">
<DropdownMenuContent side="bottom" className="w-full max-w-xs md:w-96">
<DropdownMenuGroup>
<Link href="/new">
<DropdownMenuItem className="cursor-pointer">
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/app/new/keys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
} from "@/components/ui/card";
import { Code } from "@/components/ui/code";
import { Separator } from "@/components/ui/separator";
import { toast } from "@/components/ui/toaster";
import { trpc } from "@/lib/trpc/client";
import { AlertCircle, KeyRound, Lock } from "lucide-react";
import Link from "next/link";
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/app/theme-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { ThemeProvider as NextThemesProvider } from "next-themes";
import type { ThemeProviderProps } from "next-themes/dist/types";
import * as React from "react";

export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/components/dashboard/create-key-button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import React from "react";
import { Button } from "../ui/button";

export const CreateKeyButton = (props: { apiId: string; keyAuthId: string }) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/components/dashboard/feedback-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const Feedback: React.FC<FeedbackProps> = ({ variant, FeedbackOpen }) =>
const schema = z.object({
severity: z.enum(["p0", "p1", "p2", "p3"]),
issueType: z.enum(["bug", "feature", "security", "payment", "question"]),
message: z.string(),
message: z.string().min(20, "Feedback must contain at least 20 characters"),
});

const form = useForm<z.infer<typeof schema>>({
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/components/dashboard/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { type SVGProps } from "react";
import type { SVGProps } from "react";

export function Loading({
width = 24,
Expand Down
Loading

0 comments on commit 2539db5

Please sign in to comment.