Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Long redirects urls and paths don't shorten in the UI (#4944) (#4988)

Michael9442afcb11f0
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 ab1f4173d0..350eb113c2 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<string>("");
const [newPath, setNewPath] = useState<string>("");
const [httpStatus, setHttpStatus] =
@@ -224,7 +224,7 @@ export const SectionRedirects = () => {
{redirectKeys.length > 0 ? (
<Grid css={sectionSpacing}>
<List asChild>
- <Flex direction="column" gap="1">
+ <Flex direction="column" gap="1" align="stretch">
{redirects.map((redirect, index) => {
return (
<ListItem asChild key={redirect.old} index={index}>
@@ -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}
</Link>
</Tooltip>
</Flex>
- <SmallIconButton
- variant="destructive"
- icon={<TrashIcon />}
- aria-label={`Delete redirect from ${redirect.old}`}
- onClick={() => handleDeleteRedirect(index)}
- />
+ <Flex gap="2">
+ <SmallIconButton
+ variant="destructive"
+ icon={<TrashIcon />}
+ aria-label={`Delete redirect from ${redirect.old}`}
+ onClick={() => handleDeleteRedirect(index)}
+ />
+ </Flex>
</Flex>
</ListItem>
);