Skip to content

Commit 33333e1

Browse files
committed
fix:resposniveness if project name is too long
1 parent c2211cb commit 33333e1

File tree

1 file changed

+6
-4
lines changed
  • src/routes/(console)/organization-[organization]

1 file changed

+6
-4
lines changed

src/routes/(console)/organization-[organization]/+page.svelte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import { canWriteProjects } from '$lib/stores/roles';
2727
import { checkPricingRefAndRedirect } from '$lib/helpers/pricingRedirect';
2828
import { Badge, Icon, Typography, Alert, Tag, Tooltip } from '@appwrite.io/pink-svelte';
29+
import { isSmallViewport, updateViewport } from '$lib/stores/viewport';
2930
import {
3031
IconAndroid,
3132
IconApple,
@@ -115,6 +116,7 @@
115116
};
116117
onMount(async () => {
117118
checkPricingRefAndRedirect(page.url.searchParams);
119+
updateViewport();
118120
});
119121
120122
function findRegion(project: Models.Project) {
@@ -129,7 +131,9 @@
129131
}
130132
131133
function formatName(name: string, limit: number = 19) {
132-
return name ? (name.length > limit ? `${name.slice(0, limit)}...` : name) : '-';
134+
const mobileLimit = 12;
135+
const actualLimit = $isSmallViewport ? mobileLimit : limit;
136+
return name ? (name.length > actualLimit ? `${name.slice(0, actualLimit)}...` : name) : '-';
133137
}
134138
135139
$: projectsToArchive = data.projects.projects.filter(
@@ -195,9 +199,7 @@
195199
{@const platforms = filterPlatforms(
196200
project.platforms.map((platform) => getPlatformInfo(platform.type))
197201
)}
198-
{@const formatted = isSetToArchive(project)
199-
? formatName(project.name)
200-
: project.name}
202+
{@const formatted = formatName(project.name)}
201203
<GridItem1
202204
href={`${base}/project-${project.region}-${project.$id}/overview/platforms`}>
203205
<svelte:fragment slot="eyebrow">

0 commit comments

Comments
 (0)