Skip to content

Commit 5d54301

Browse files
authored
feat: Improve source editing UX (#805)
Background: the gear icon on the search page showed a modal for editing the source. Due to low friction and lack of context clues, it appeared as if those settings are ad-hoc for the current query. The new UX is a dropdown with a link to the Teams page to make it clear that those are team-wide settings. ![Screenshot 2025-05-10 at 8 16 24 PM](https://github.com/user-attachments/assets/c2280bed-a29c-460f-8243-5785cda87c3e)
1 parent 0f82b15 commit 5d54301

File tree

4 files changed

+50
-34
lines changed

4 files changed

+50
-34
lines changed

packages/app/src/DBSearchPage.tsx

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
useState,
88
} from 'react';
99
import dynamic from 'next/dynamic';
10+
import Link from 'next/link';
1011
import router from 'next/router';
1112
import {
1213
parseAsBoolean,
@@ -38,6 +39,7 @@ import {
3839
Flex,
3940
Grid,
4041
Group,
42+
Menu,
4143
Modal,
4244
Paper,
4345
Stack,
@@ -748,7 +750,7 @@ function DBSearchPage() {
748750
[setRowId, setIsLive],
749751
);
750752

751-
const [modelFormExpanded, setModelFormExpanded] = useState(false);
753+
const [modelFormExpanded, setModelFormExpanded] = useState(false); // Used in local mode
752754
const [saveSearchModalState, setSaveSearchModalState] = useState<
753755
'create' | 'update' | undefined
754756
>(undefined);
@@ -1018,17 +1020,45 @@ function DBSearchPage() {
10181020
setNewSourceModalOpened(true);
10191021
}}
10201022
/>
1021-
<ActionIcon
1022-
variant="subtle"
1023-
color="dark.2"
1024-
size="sm"
1025-
onClick={() => setModelFormExpanded(v => !v)}
1026-
title="Edit Source"
1027-
>
1028-
<Text size="xs">
1029-
<i className="bi bi-gear" />
1030-
</Text>
1031-
</ActionIcon>
1023+
<Menu withArrow position="bottom-start">
1024+
<Menu.Target>
1025+
<ActionIcon
1026+
variant="subtle"
1027+
color="dark.2"
1028+
size="sm"
1029+
title="Edit Source"
1030+
>
1031+
<Text size="xs">
1032+
<i className="bi bi-gear" />
1033+
</Text>
1034+
</ActionIcon>
1035+
</Menu.Target>
1036+
<Menu.Dropdown>
1037+
<Menu.Label>Sources</Menu.Label>
1038+
<Menu.Item
1039+
leftSection={<i className="bi bi-plus-circle" />}
1040+
onClick={() => setNewSourceModalOpened(true)}
1041+
>
1042+
Create New Source
1043+
</Menu.Item>
1044+
{IS_LOCAL_MODE ? (
1045+
<Menu.Item
1046+
leftSection={<i className="bi bi-gear" />}
1047+
onClick={() => setModelFormExpanded(v => !v)}
1048+
>
1049+
Edit Source
1050+
</Menu.Item>
1051+
) : (
1052+
<Menu.Item
1053+
leftSection={<i className="bi bi-gear" />}
1054+
component={Link}
1055+
href="/team"
1056+
>
1057+
Edit Sources
1058+
</Menu.Item>
1059+
)}
1060+
</Menu.Dropdown>
1061+
</Menu>
10321062
</Group>
10331063
<Box style={{ minWidth: 100, flexGrow: 1 }}>
10341064
<SQLInlineEditorControlled

packages/app/src/TeamPage.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
import { Fragment, useCallback, useMemo, useState } from 'react';
22
import Head from 'next/head';
33
import { HTTPError } from 'ky';
4-
import {
5-
Button as BSButton,
6-
Form,
7-
Modal as BSModal,
8-
Spinner,
9-
} from 'react-bootstrap';
4+
import { Button as BSButton, Modal as BSModal } from 'react-bootstrap';
105
import { CopyToClipboard } from 'react-copy-to-clipboard';
116
import { SubmitHandler, useForm } from 'react-hook-form';
127
import { json, jsonParseLinter } from '@codemirror/lang-json';
138
import { linter } from '@codemirror/lint';
14-
import { EditorView, ViewUpdate } from '@codemirror/view';
9+
import { EditorView } from '@codemirror/view';
1510
import { SourceKind, WebhookService } from '@hyperdx/common-utils/dist/types';
1611
import {
1712
Alert,
1813
Badge,
1914
Box,
2015
Button,
2116
Card,
17+
Center,
2218
Container,
2319
Divider,
2420
Flex,
2521
Group,
22+
Loader,
2623
Modal as MModal,
2724
Radio,
2825
Stack,
@@ -46,8 +43,6 @@ import { useSources } from './source';
4643
import { useConfirm } from './useConfirm';
4744
import { capitalizeFirstLetter } from './utils';
4845

49-
import styles from '../styles/TeamPage.module.scss';
50-
5146
const DEFAULT_GENERIC_WEBHOOK_BODY = ['{{title}}', '{{body}}', '{{link}}'];
5247
const DEFAULT_GENERIC_WEBHOOK_BODY_TEMPLATE =
5348
DEFAULT_GENERIC_WEBHOOK_BODY.join(' | ');
@@ -1223,9 +1218,9 @@ export default function TeamPage() {
12231218
<div>
12241219
<Container>
12251220
{isLoading && (
1226-
<Spinner animation="border" role="status">
1227-
<span className="visually-hidden">Loading...</span>
1228-
</Spinner>
1221+
<Center mt="xl">
1222+
<Loader color="dimmed" />
1223+
</Center>
12291224
)}
12301225
{!isLoading && team != null && (
12311226
<Stack my={20} gap="xl">

packages/app/src/components/ConfirmDeleteMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default function ConfirmDeleteMenu({
66
onDelete: () => void;
77
}) {
88
return (
9-
<Menu>
9+
<Menu withArrow>
1010
<Menu.Target>
1111
<Button variant="outline" color="gray.4" size="xs">
1212
Delete

packages/app/styles/TeamPage.module.scss

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)