Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions apps/web/app/api/folders/[folderId]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const GET = withWorkspace(
"advanced",
"enterprise",
],
featureFlag: "linkFolders",
},
);

Expand Down Expand Up @@ -104,7 +103,6 @@ export const PATCH = withWorkspace(
"advanced",
"enterprise",
],
featureFlag: "linkFolders",
},
);

Expand Down Expand Up @@ -175,6 +173,5 @@ export const DELETE = withWorkspace(
"advanced",
"enterprise",
],
featureFlag: "linkFolders",
},
);
1 change: 0 additions & 1 deletion apps/web/app/api/folders/[folderId]/users/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,5 @@ export const GET = withWorkspace(
"advanced",
"enterprise",
],
featureFlag: "linkFolders",
},
);
1 change: 0 additions & 1 deletion apps/web/app/api/folders/access-requests/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ export const GET = withWorkspace(
"advanced",
"enterprise",
],
featureFlag: "linkFolders",
},
);
1 change: 0 additions & 1 deletion apps/web/app/api/folders/count/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@ export const GET = withWorkspace(
},
{
requiredPermissions: ["folders.read"],
featureFlag: "linkFolders",
},
);
1 change: 0 additions & 1 deletion apps/web/app/api/folders/permissions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,5 @@ export const GET = withWorkspace(
"advanced",
"enterprise",
],
featureFlag: "linkFolders",
},
);
2 changes: 0 additions & 2 deletions apps/web/app/api/folders/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const GET = withWorkspace(
"advanced",
"enterprise",
],
featureFlag: "linkFolders",
},
);

Expand Down Expand Up @@ -124,6 +123,5 @@ export const POST = withWorkspace(
"advanced",
"enterprise",
],
featureFlag: "linkFolders",
},
);
5 changes: 0 additions & 5 deletions apps/web/app/api/workspaces/[idOrSlug]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ export const GET = withWorkspace(
...workspace,
id: prefixWorkspaceId(workspace.id),
domains,
// TODO: Remove this once Folders goes GA
flags: {
...flags,
linkFolders: flags.linkFolders || workspace.partnersEnabled,
},
}),
},
{ headers },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ function LinkBuilder({ link }: { link: ExpandedLinkProps }) {
);
}}
className="p-0"
foldersEnabled={!!workspace.flags?.linkFolders}
linkToFolder={!!workspace.flags?.linkFolders}
>
<div
className={cn(
Expand Down
14 changes: 0 additions & 14 deletions apps/web/app/app.dub.co/(dashboard)/[slug]/links/links-title.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions apps/web/app/app.dub.co/(dashboard)/[slug]/links/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FolderSwitcher } from "@/ui/folders/folder-switcher";
import { PageContent } from "@/ui/layout/page-content";
import { LinksTitle } from "./links-title";
import WorkspaceLinksClient from "./page-client";

export default function WorkspaceLinks() {
return (
<PageContent title={<LinksTitle />}>
<PageContent title={<FolderSwitcher />}>
<WorkspaceLinksClient />
</PageContent>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ export default function PlanUsage() {
<div
className={cn(
"grid grid-cols-1 gap-[1px] overflow-hidden rounded-b-lg bg-neutral-200 md:grid-cols-3",
flags?.linkFolders &&
"md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-4",
"md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-4",
!partnersEnabled && "rounded-b-lg",
)}
>
Expand All @@ -197,15 +196,13 @@ export default function PlanUsage() {
usageLimit={domainsLimit}
href={`/${slug}/settings/domains`}
/>
{flags?.linkFolders && (
<UsageCategory
title="Folders"
icon={Folder5}
usage={foldersUsage}
usageLimit={foldersLimit}
href={`/${slug}/settings/library/folders`}
/>
)}
<UsageCategory
title="Folders"
icon={Folder5}
usage={foldersUsage}
usageLimit={foldersLimit}
href={`/${slug}/settings/library/folders`}
/>
<UsageCategory
title="Tags"
icon={Tag}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ export const FoldersPageClient = () => {
const showAllLinkFolder =
!searchParams.get("search") || folders?.length === 0;

if (flags && !flags.linkFolders) {
router.push("/settings");
}

const { pagination, setPagination } = usePagination(FOLDERS_MAX_PAGE_SIZE);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export default function LibraryHeader() {
const page = selectedLayoutSegment === null ? "" : selectedLayoutSegment;

if (selectedLayoutSegment === null) {
redirect(
`/${slug}/settings/library/${flags?.linkFolders ? "folders" : "tags"}`,
);
redirect(`/${slug}/settings/library/folders`);
}

return (
Expand All @@ -29,15 +27,11 @@ export default function LibraryHeader() {
<TabSelect
variant="accent"
options={[
...(flags?.linkFolders
? [
{
id: "folders",
label: "Folders",
href: `/${slug}/settings/library/folders`,
},
]
: []),
{
id: "folders",
label: "Folders",
href: `/${slug}/settings/library/folders`,
},
{ id: "tags", label: "Tags", href: `/${slug}/settings/library/tags` },
{
id: "utm",
Expand Down
6 changes: 0 additions & 6 deletions apps/web/lib/auth/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,6 @@ export const withWorkspace = (
workspaceId: workspace.id,
});

// TODO: Remove this once Folders goes GA
flags = {
...flags,
linkFolders: flags.linkFolders || workspace.partnersEnabled,
};

if (!flags[featureFlag]) {
throw new DubApiError({
code: "forbidden",
Expand Down
1 change: 0 additions & 1 deletion apps/web/lib/edge-config/get-feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const getFeatureFlags = async ({

const workspaceFeatures: Record<BetaFeatures, boolean> = {
noDubLink: false,
linkFolders: false,
abTesting: false,
};

Expand Down
4 changes: 2 additions & 2 deletions apps/web/lib/swr/use-folder-access-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import useSWR from "swr";
import useWorkspace from "./use-workspace";

export function useFolderAccessRequests() {
const { id, plan, flags } = useWorkspace();
const { id, plan } = useWorkspace();

const { data, error, isLoading, isValidating, mutate } = useSWR<
FolderAccessRequest[]
>(
id && flags?.linkFolders && plan !== "free" && plan !== "pro"
id && plan !== "free" && plan !== "pro"
? `/api/folders/access-requests?workspaceId=${id}`
: null,
fetcher,
Expand Down
4 changes: 2 additions & 2 deletions apps/web/lib/swr/use-folder-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import useSWR from "swr";
import useWorkspace from "./use-workspace";

export function useFolderPermissions() {
const { id, plan, flags } = useWorkspace();
const { id, plan } = useWorkspace();

const { data, error, isLoading, mutate } = useSWR<FolderWithPermissions[]>(
id && flags?.linkFolders && plan !== "free" && plan !== "pro"
id && plan !== "free" && plan !== "pro"
? `/api/folders/permissions?workspaceId=${id}`
: null,
fetcher,
Expand Down
3 changes: 1 addition & 2 deletions apps/web/lib/swr/use-folder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ export default function useFolder({
folderId?: string | null;
enabled?: boolean;
}) {
const { id: workspaceId, plan, flags } = useWorkspace();
const { id: workspaceId, plan } = useWorkspace();

const swrEnabled =
enabled &&
folderId &&
folderId !== "unsorted" &&
workspaceId &&
flags?.linkFolders &&
plan !== "free";

const {
Expand Down
6 changes: 2 additions & 4 deletions apps/web/lib/swr/use-folders-count.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function useFoldersCount({
includeParams?: boolean;
query?: Record<string, any>;
} = {}) {
const { id: workspaceId, plan, flags } = useWorkspace();
const { id: workspaceId, plan } = useWorkspace();

const { getQueryString } = useRouterStuff();

Expand All @@ -20,9 +20,7 @@ export default function useFoldersCount({
);

const { data, error } = useSWR<number>(
workspaceId && flags?.linkFolders && plan !== "free"
? `/api/folders/count${qs}`
: null,
workspaceId && plan !== "free" ? `/api/folders/count${qs}` : null,
fetcher,
{
dedupingInterval: 60000,
Expand Down
4 changes: 2 additions & 2 deletions apps/web/lib/swr/use-folders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function useFolders({
query?: Record<string, any>;
options?: SWRConfiguration;
} = {}) {
const { id: workspaceId, plan, flags } = useWorkspace();
const { id: workspaceId, plan } = useWorkspace();
const { getQueryString } = useRouterStuff();

const qs = getQueryString(
Expand All @@ -28,7 +28,7 @@ export default function useFolders({
isValidating,
isLoading,
} = useSWR<Folder[]>(
workspaceId && flags?.linkFolders && plan !== "free"
workspaceId && plan !== "free"
? `/api/folders${qs}${includeLinkCount ? "&includeLinkCount=true" : ""}`
: null,
fetcher,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export type PlanProps = (typeof plans)[number];

export type RoleProps = (typeof roles)[number];

export type BetaFeatures = "noDubLink" | "linkFolders" | "abTesting";
export type BetaFeatures = "noDubLink" | "abTesting";

export interface WorkspaceProps extends Project {
logo: string | null;
Expand Down
82 changes: 39 additions & 43 deletions apps/web/ui/analytics/toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -452,50 +452,46 @@ export default function Toggle({
? [LinkFilterItem, CustomerFilterItem]
: [
...(canManageCustomers ? [CustomerFilterItem] : []),
...(flags?.linkFolders
? [
{
key: "folderId",
icon: Folder,
label: "Folder",
shouldFilter: !foldersAsync,
getOptionIcon: (value, props) => {
const folderName = props.option?.label;
const folder = folders?.find(
({ name }) => name === folderName,
);
{
key: "folderId",
icon: Folder,
label: "Folder",
shouldFilter: !foldersAsync,
getOptionIcon: (value, props) => {
const folderName = props.option?.label;
const folder = folders?.find(
({ name }) => name === folderName,
);

return folder ? (
<FolderIcon
folder={folder}
shape="square"
iconClassName="size-3"
/>
) : null;
},
options: loadingFolders
? null
: [
...(folders || []),
// Add currently filtered folder if not already in the list
...(selectedFolder &&
!folders?.find((f) => f.id === selectedFolder.id)
? [selectedFolder]
: []),
].map((folder) => ({
value: folder.id,
icon: (
<FolderIcon
folder={folder}
shape="square"
iconClassName="size-3"
/>
),
label: folder.name,
})),
},
]
: []),
return folder ? (
<FolderIcon
folder={folder}
shape="square"
iconClassName="size-3"
/>
) : null;
},
options: loadingFolders
? null
: [
...(folders || []),
// Add currently filtered folder if not already in the list
...(selectedFolder &&
!folders?.find((f) => f.id === selectedFolder.id)
? [selectedFolder]
: []),
].map((folder) => ({
value: folder.id,
icon: (
<FolderIcon
folder={folder}
shape="square"
iconClassName="size-3"
/>
),
label: folder.name,
})),
},
{
key: "tagIds",
icon: Tag,
Expand Down
Loading