Skip to content

Commit 2b842f0

Browse files
committed
sidequest: fix the link shortener ui
1 parent b49308c commit 2b842f0

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

src/ui/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type KnownGroups = {
2222

2323
export type ConfigType = {
2424
AadValidClientId: string;
25+
LinkryPublicUrl: string;
2526
ServiceConfiguration: Record<ValidServices, ServiceConfiguration>;
2627
KnownGroupMappings: KnownGroups;
2728
};
@@ -43,6 +44,7 @@ type EnvironmentConfigType = {
4344
const environmentConfig: EnvironmentConfigType = {
4445
"local-dev": {
4546
AadValidClientId: "d1978c23-6455-426a-be4d-528b2d2e4026",
47+
LinkryPublicUrl: "go.aws.qa.acmuiuc.org",
4648
ServiceConfiguration: {
4749
core: {
4850
friendlyName: "Core Management Service (NonProd)",
@@ -75,6 +77,7 @@ const environmentConfig: EnvironmentConfigType = {
7577
},
7678
dev: {
7779
AadValidClientId: "d1978c23-6455-426a-be4d-528b2d2e4026",
80+
LinkryPublicUrl: "go.aws.qa.acmuiuc.org",
7881
ServiceConfiguration: {
7982
core: {
8083
friendlyName: "Core Management Service (NonProd)",
@@ -107,6 +110,7 @@ const environmentConfig: EnvironmentConfigType = {
107110
},
108111
prod: {
109112
AadValidClientId: "43fee67e-e383-4071-9233-ef33110e9386",
113+
LinkryPublicUrl: "go.acm.illinois.edu",
110114
ServiceConfiguration: {
111115
core: {
112116
friendlyName: "Core Management Service",

src/ui/pages/linkry/LinkShortener.page.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,16 @@ import {
1616
} from "@mantine/core";
1717
import { useDisclosure } from "@mantine/hooks";
1818
import { notifications } from "@mantine/notifications";
19-
import {
20-
IconCancel,
21-
IconCross,
22-
IconEdit,
23-
IconPlus,
24-
IconTrash,
25-
} from "@tabler/icons-react";
26-
import dayjs from "dayjs";
19+
import { IconCancel, IconEdit, IconPlus, IconTrash } from "@tabler/icons-react";
2720
import React, { useEffect, useState } from "react";
2821
import { useNavigate } from "react-router-dom";
2922
import { z } from "zod";
3023

31-
import { capitalizeFirstLetter } from "./ManageLink.page.js";
32-
import FullScreenLoader from "@ui/components/AuthContext/LoadingScreen";
3324
import { AuthGuard } from "@ui/components/AuthGuard";
3425
import { useApi } from "@ui/util/api";
3526
import { AppRoles } from "@common/roles.js";
36-
import { wrap } from "module";
3727
import { linkRecord } from "@common/types/linkry.js";
28+
import { getRunEnvironmentConfig } from "@ui/config.js";
3829

3930
const wrapTextStyle: React.CSSProperties = {
4031
wordWrap: "break-word",
@@ -82,7 +73,7 @@ export const LinkShortener: React.FC = () => {
8273
}}
8374
>
8475
<Table.Td style={wrapTextStyle}>
85-
https://go.acm.illinois.edu/{link.slug}
76+
{getRunEnvironmentConfig().LinkryPublicUrl}/{link.slug}
8677
</Table.Td>
8778
<Table.Td style={wrapTextStyle}>
8879
<Anchor href={link.redirect} target="_blank" size="sm">

src/ui/pages/linkry/ManageLink.page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ import { IconDeviceFloppy } from "@tabler/icons-react";
1919
import { LinkryGroupUUIDToGroupNameMap } from "@common/config";
2020
import FullScreenLoader from "@ui/components/AuthContext/LoadingScreen";
2121
import { LINKRY_MAX_SLUG_LENGTH } from "@common/types/linkry";
22+
import { getRunEnvironmentConfig } from "@ui/config";
2223

2324
export function capitalizeFirstLetter(string: string) {
2425
return string.charAt(0).toUpperCase() + string.slice(1);
2526
}
2627

27-
const baseUrl = "go.acm.illinois.edu";
28+
const baseUrl = getRunEnvironmentConfig().LinkryPublicUrl;
2829
const slugRegex = new RegExp("^(https?://)?[a-zA-Z0-9-._/]*$");
2930
const urlRegex = new RegExp("^https?://[a-zA-Z0-9-._/?=&+:]*$");
3031

@@ -205,7 +206,7 @@ export const ManageLinkPage: React.FC = () => {
205206
rightSectionWidth="150px"
206207
leftSection={
207208
<Button variant="outline" mr="auto" size="auto">
208-
{baseUrl || "go.acm.illinois.edu"}
209+
{baseUrl}
209210
</Button>
210211
}
211212
rightSection={
@@ -216,7 +217,7 @@ export const ManageLinkPage: React.FC = () => {
216217
color="blue"
217218
onClick={generateRandomSlug}
218219
>
219-
Generate Random URL
220+
Random
220221
</Button>
221222
)
222223
}

0 commit comments

Comments
 (0)