diff --git a/apps/builder/app/builder/features/project-settings/section-redirects.tsx b/apps/builder/app/builder/features/project-settings/section-redirects.tsx index ab1f4173d0bd..350eb113c2be 100644 --- a/apps/builder/app/builder/features/project-settings/section-redirects.tsx +++ b/apps/builder/app/builder/features/project-settings/section-redirects.tsx @@ -1,20 +1,17 @@ -import { useState, type ChangeEvent, useRef } from "react"; -import { flushSync } from "react-dom"; import { useStore } from "@nanostores/react"; import { - Grid, + Button, Flex, + Grid, + InputErrorsTooltip, InputField, - Button, - Text, - theme, + Link, List, ListItem, - SmallIconButton, - InputErrorsTooltip, Select, - Link, - truncate, + SmallIconButton, + Text, + theme, Tooltip, } from "@webstudio-is/design-system"; import { ArrowRightIcon, TrashIcon } from "@webstudio-is/icons"; @@ -23,9 +20,11 @@ import { PageRedirect, ProjectNewRedirectPath, } from "@webstudio-is/sdk"; +import { useRef, useState, type ChangeEvent } from "react"; +import { flushSync } from "react-dom"; +import { matchPathnamePattern } from "~/builder/shared/url-pattern"; import { $pages, $publishedOrigin } from "~/shared/nano-states"; import { serverSyncStore } from "~/shared/sync"; -import { matchPathnamePattern } from "~/builder/shared/url-pattern"; import { getExistingRoutePaths, sectionSpacing } from "./utils"; export const SectionRedirects = () => { @@ -33,6 +32,7 @@ export const SectionRedirects = () => { const [redirects, setRedirects] = useState( () => $pages.get()?.redirects ?? [] ); + const [oldPath, setOldPath] = useState(""); const [newPath, setNewPath] = useState(""); const [httpStatus, setHttpStatus] = @@ -224,7 +224,7 @@ export const SectionRedirects = () => { {redirectKeys.length > 0 ? ( - + {redirects.map((redirect, index) => { return ( @@ -245,7 +245,10 @@ export const SectionRedirects = () => { redirect.old, publishedOrigin ).toString()} - css={truncate()} + css={{ + width: theme.spacing[18], + wordBreak: "break-all", + }} target="_blank" > {redirect.old} @@ -262,19 +265,24 @@ export const SectionRedirects = () => { redirect.new, publishedOrigin ).toString()} - css={truncate()} + css={{ + wordBreak: "break-all", + maxWidth: theme.spacing[30], + }} target="_blank" > {redirect.new} - } - aria-label={`Delete redirect from ${redirect.old}`} - onClick={() => handleDeleteRedirect(index)} - /> + + } + aria-label={`Delete redirect from ${redirect.old}`} + onClick={() => handleDeleteRedirect(index)} + /> + );