mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
refactor: eslint and prettier conflict will be resolved and formatted
This commit is contained in:
@@ -60,9 +60,8 @@ export default async function WorkspacePage({ params, searchParams }: WorkspaceP
|
||||
|
||||
const pageParam = resolvedSearchParams?.page;
|
||||
const parsedPage = pageParam ? Number(pageParam) : 1;
|
||||
const page = Number.isSafeInteger(parsedPage) && parsedPage > 0 && parsedPage <= MAX_PAGE
|
||||
? parsedPage
|
||||
: 1;
|
||||
const page =
|
||||
Number.isSafeInteger(parsedPage) && parsedPage > 0 && parsedPage <= MAX_PAGE ? parsedPage : 1;
|
||||
const pageSize = 20;
|
||||
const skip = (page - 1) * pageSize;
|
||||
|
||||
@@ -94,7 +93,10 @@ export default async function WorkspacePage({ params, searchParams }: WorkspaceP
|
||||
const membership = workspace.members[0];
|
||||
const isMember = !!membership;
|
||||
const isAdmin = isOwner || membership?.role === 'ADMIN';
|
||||
const access = await checkWorkspaceAccess({ id: workspace.id, ownerId: workspace.ownerId }, session.user.id);
|
||||
const access = await checkWorkspaceAccess(
|
||||
{ id: workspace.id, ownerId: workspace.ownerId },
|
||||
session.user.id
|
||||
);
|
||||
|
||||
if (!access.hasAccess || (!isOwner && !isMember)) {
|
||||
redirect('/dashboard');
|
||||
@@ -213,7 +215,12 @@ export default async function WorkspacePage({ params, searchParams }: WorkspaceP
|
||||
<span className="text-sm font-medium">
|
||||
Page {page} of {totalPages}
|
||||
</span>
|
||||
<Button variant="outline" size="sm" disabled={page >= totalPages} asChild={page < totalPages}>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={page >= totalPages}
|
||||
asChild={page < totalPages}
|
||||
>
|
||||
{page < totalPages ? (
|
||||
<Link href={`/workspaces/${workspaceId}?page=${page + 1}`}>Next</Link>
|
||||
) : (
|
||||
|
||||
+7
-3
@@ -12,7 +12,12 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
|
||||
type Visibility = 'PRIVATE' | 'INVITE' | 'PUBLIC';
|
||||
|
||||
const visibilityOptions: { value: Visibility; label: string; description: string; icon: React.ReactNode }[] = [
|
||||
const visibilityOptions: {
|
||||
value: Visibility;
|
||||
label: string;
|
||||
description: string;
|
||||
icon: React.ReactNode;
|
||||
}[] = [
|
||||
{
|
||||
value: 'PRIVATE',
|
||||
label: 'Private',
|
||||
@@ -111,8 +116,7 @@ export default function NewWorkspaceProjectPageClient({ workspaceId }: { workspa
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="description" className="text-sm font-medium">
|
||||
Description{' '}
|
||||
<span className="text-muted-foreground font-normal">(optional)</span>
|
||||
Description <span className="text-muted-foreground font-normal">(optional)</span>
|
||||
</Label>
|
||||
<Textarea
|
||||
id="description"
|
||||
|
||||
+6
-8
@@ -148,9 +148,7 @@ export default function WorkspaceSettingsPageClient({
|
||||
|
||||
<div className="mb-8">
|
||||
<h1 className="text-3xl font-bold tracking-tight">Workspace Settings</h1>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
Manage workspace configuration
|
||||
</p>
|
||||
<p className="text-muted-foreground mt-1">Manage workspace configuration</p>
|
||||
</div>
|
||||
|
||||
<Card className="mb-8">
|
||||
@@ -215,9 +213,7 @@ export default function WorkspaceSettingsPageClient({
|
||||
<Card className="border-destructive/50">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-destructive">Danger Zone</CardTitle>
|
||||
<CardDescription>
|
||||
Irreversible actions. Proceed with caution.
|
||||
</CardDescription>
|
||||
<CardDescription>Irreversible actions. Proceed with caution.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<AlertDialog>
|
||||
@@ -234,11 +230,13 @@ export default function WorkspaceSettingsPageClient({
|
||||
<div className="space-y-4">
|
||||
<p>
|
||||
This will permanently delete this workspace and everything inside it
|
||||
(projects, videos, comments, images, and voice notes). This action cannot be undone.
|
||||
(projects, videos, comments, images, and voice notes). This action cannot
|
||||
be undone.
|
||||
</p>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="delete-workspace-confirm">
|
||||
Type <strong className="text-foreground">{workspace.name}</strong> to confirm
|
||||
Type <strong className="text-foreground">{workspace.name}</strong> to
|
||||
confirm
|
||||
</Label>
|
||||
<Input
|
||||
id="delete-workspace-confirm"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Skeleton } from "@/components/ui/skeleton"
|
||||
import { Card, CardHeader, CardContent } from "@/components/ui/card"
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Card, CardHeader, CardContent } from '@/components/ui/card';
|
||||
|
||||
function WorkspaceCardSkeleton() {
|
||||
return (
|
||||
@@ -20,7 +20,7 @@ function WorkspaceCardSkeleton() {
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default function WorkspacesLoading() {
|
||||
@@ -40,5 +40,5 @@ export default function WorkspacesLoading() {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,9 +95,7 @@ export default function NewWorkspacePage({
|
||||
id="name"
|
||||
placeholder="e.g., My Studio"
|
||||
value={formData.name}
|
||||
onChange={(e) =>
|
||||
setFormData({ ...formData, name: e.target.value })
|
||||
}
|
||||
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
||||
required
|
||||
disabled={isLoading}
|
||||
/>
|
||||
@@ -112,9 +110,7 @@ export default function NewWorkspacePage({
|
||||
id="description"
|
||||
placeholder="What is this workspace for?"
|
||||
value={formData.description}
|
||||
onChange={(e) =>
|
||||
setFormData({ ...formData, description: e.target.value })
|
||||
}
|
||||
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
|
||||
rows={3}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
@@ -140,7 +136,8 @@ export default function NewWorkspacePage({
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
You can still create and manage projects inside workspaces where you are already a member.
|
||||
You can still create and manage projects inside workspaces where you are already a
|
||||
member.
|
||||
</p>
|
||||
<Button asChild className="w-full">
|
||||
<Link href="/settings">Open Billing Settings</Link>
|
||||
|
||||
@@ -2,13 +2,16 @@ import { auth } from '@/lib/auth';
|
||||
import { redirect } from 'next/navigation';
|
||||
import { db } from '@/lib/db';
|
||||
import { buildBillingAccessWhereInput, getBillingOverview } from '@/lib/billing';
|
||||
import { hasCollaboratorBillingBackedAccess, requireBillingAccessOrRedirect } from '@/lib/route-access';
|
||||
import {
|
||||
hasCollaboratorBillingBackedAccess,
|
||||
requireBillingAccessOrRedirect,
|
||||
} from '@/lib/route-access';
|
||||
import { WorkspacesClient } from './workspaces-client';
|
||||
|
||||
export default async function WorkspacesPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ page?: string }>
|
||||
searchParams: Promise<{ page?: string }>;
|
||||
}) {
|
||||
const session = await auth();
|
||||
if (!session?.user?.id) {
|
||||
@@ -52,7 +55,7 @@ export default async function WorkspacesPage({
|
||||
{ ownerId: session.user.id, owner: buildBillingAccessWhereInput() },
|
||||
{ members: { some: { userId: session.user.id } }, owner: buildBillingAccessWhereInput() },
|
||||
],
|
||||
}
|
||||
},
|
||||
}),
|
||||
getBillingOverview(session.user.id),
|
||||
]);
|
||||
@@ -64,7 +67,7 @@ export default async function WorkspacesPage({
|
||||
name: w.name,
|
||||
description: w.description,
|
||||
updatedAt: w.updatedAt.toISOString(),
|
||||
_count: w._count
|
||||
_count: w._count,
|
||||
}));
|
||||
|
||||
return (
|
||||
|
||||
@@ -55,9 +55,7 @@ export function WorkspacesClient({
|
||||
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-8">
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold tracking-tight">Workspaces</h1>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
Manage your workspaces and their projects
|
||||
</p>
|
||||
<p className="text-muted-foreground mt-1">Manage your workspaces and their projects</p>
|
||||
{!workspaceCreation.canCreateWorkspace && workspaceCreation.reason ? (
|
||||
<p className="text-sm text-amber-700 dark:text-amber-400 mt-2">
|
||||
{workspaceCreation.reason}
|
||||
@@ -73,9 +71,7 @@ export function WorkspacesClient({
|
||||
</Button>
|
||||
) : (
|
||||
<Button asChild className="w-full sm:w-auto">
|
||||
<Link href="/settings">
|
||||
Upgrade to Create Workspace
|
||||
</Link>
|
||||
<Link href="/settings">Upgrade to Create Workspace</Link>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user