Date: Tue, 11 Mar 2025 09:11:02 -0700
Subject: [PATCH 07/16] Update
packages/web/app/src/components/ui/input-copy.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
---
packages/web/app/src/components/ui/input-copy.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/web/app/src/components/ui/input-copy.tsx b/packages/web/app/src/components/ui/input-copy.tsx
index b98bb12e32..216b81f1ec 100644
--- a/packages/web/app/src/components/ui/input-copy.tsx
+++ b/packages/web/app/src/components/ui/input-copy.tsx
@@ -31,7 +31,7 @@ export function InputCopy(props: { value: string; alignment?: 'center' | 'left'
type="text"
value={props.value}
readOnly
- className={`bg-secondary truncate text-white${props.alignment === 'center' ? 'text-center' : ''}`}
+ className={`bg-secondary truncate text-white ${props.alignment === 'center' ? 'text-center' : ''}`}
onFocus={ev => ev.target.select()}
/>
From c2add1fb30f1b42804749970bc5cd70233c40608 Mon Sep 17 00:00:00 2001
From: jdolle <1841898+jdolle@users.noreply.github.com>
Date: Tue, 11 Mar 2025 13:16:11 -0700
Subject: [PATCH 08/16] Separate check noschema from others; adjust ui per
feedback
---
.../web/app/src/components/ui/empty-list.tsx | 68 ++++++++++++-------
.../web/app/src/components/ui/input-copy.tsx | 4 +-
packages/web/app/src/pages/target-apps.tsx | 5 +-
packages/web/app/src/pages/target-checks.tsx | 15 +++-
.../src/pages/target-explorer-deprecated.tsx | 5 +-
.../app/src/pages/target-explorer-type.tsx | 5 +-
.../app/src/pages/target-explorer-unused.tsx | 5 +-
.../web/app/src/pages/target-explorer.tsx | 5 +-
packages/web/app/src/pages/target-history.tsx | 5 +-
packages/web/app/src/pages/target.tsx | 2 +-
10 files changed, 83 insertions(+), 36 deletions(-)
diff --git a/packages/web/app/src/components/ui/empty-list.tsx b/packages/web/app/src/components/ui/empty-list.tsx
index a10ce38a1b..d8d17fcb3a 100644
--- a/packages/web/app/src/components/ui/empty-list.tsx
+++ b/packages/web/app/src/components/ui/empty-list.tsx
@@ -2,6 +2,7 @@ import { ReactElement, ReactNode } from 'react';
import magnifier from '../../../public/images/figures/magnifier.svg?url';
import { ProjectType } from '@/gql/graphql';
import { cn } from '@/lib/utils';
+import { InlineCode } from '../v2/inline-code';
import { Card } from './card';
import { DocsLink } from './docs-note';
import { Heading } from './heading';
@@ -48,41 +49,58 @@ export const noSchema = (
/>
);
-// @todo consider monolith vs distributed etc
export const NoSchemaVersion = ({
- projectType,
+ projectType = null,
+ recommendedAction = 'none',
}: {
projectType: ProjectType | null;
+ recommendedAction: 'publish' | 'check' | 'none';
}): ReactElement => {
- const isDistributed =
- projectType === ProjectType.Federation || projectType === ProjectType.Stitching;
+ let children: ReactElement | null = null;
+ if (recommendedAction !== 'none') {
+ const isDistributed =
+ projectType === ProjectType.Federation || projectType === ProjectType.Stitching;
+
+ if (recommendedAction === 'check') {
+ children = (
+ <>
+
+ It's recommended to check that the schema is valid and compatible with the state of the
+ registry before publishing.
+
+
+ >
+ );
+ } else if (recommendedAction === 'publish') {
+ children = (
+ <>
+ {isDistributed && (
+
+ For distributed systems, it's recommended to publish the schema after the service is
+ deployed.
+
+ )}
+
+ >
+ );
+ }
+ }
+
return (
- <>
-
- First check that the schema is valid and compatible with the state of the registry.
-
-
-
--url ' : ''}`}
- alignment="center"
- />
-
-
- Then publish the schema. For distributed systems, it's recommended to publish the schema
- after the service is deployed.
-
-
-
--url ' : ''}`}
- alignment="center"
- />
-
- >
+ {children}
);
};
diff --git a/packages/web/app/src/components/ui/input-copy.tsx b/packages/web/app/src/components/ui/input-copy.tsx
index 216b81f1ec..d9a9288c24 100644
--- a/packages/web/app/src/components/ui/input-copy.tsx
+++ b/packages/web/app/src/components/ui/input-copy.tsx
@@ -4,7 +4,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { useClipboard } from '@/lib/hooks';
-export function InputCopy(props: { value: string; alignment?: 'center' | 'left' }) {
+export function InputCopy(props: { value: string }) {
const [isCopied, setIsCopied] = useState(false);
const copyToClipboard = useClipboard();
@@ -31,7 +31,7 @@ export function InputCopy(props: { value: string; alignment?: 'center' | 'left'
type="text"
value={props.value}
readOnly
- className={`bg-secondary truncate text-white ${props.alignment === 'center' ? 'text-center' : ''}`}
+ className="bg-secondary truncate text-white"
onFocus={ev => ev.target.select()}
/>
diff --git a/packages/web/app/src/pages/target-apps.tsx b/packages/web/app/src/pages/target-apps.tsx
index 0c1cd48066..40cfc5b712 100644
--- a/packages/web/app/src/pages/target-apps.tsx
+++ b/packages/web/app/src/pages/target-apps.tsx
@@ -258,7 +258,10 @@ function TargetAppsView(props: {
) : !data.data?.target?.latestSchemaVersion ? (
-
+
) : !data.data.target.appDeployments ? (
- {hasActiveSchemaCheck ? 'List is empty' : 'Your schema check list is empty'}
+ {hasActiveSchemaCheck ? (
+ 'List is empty'
+ ) : (
+
+ )}
{hasActiveSchemaCheck
diff --git a/packages/web/app/src/pages/target-explorer-deprecated.tsx b/packages/web/app/src/pages/target-explorer-deprecated.tsx
index 4b27a3cf02..c8ea236049 100644
--- a/packages/web/app/src/pages/target-explorer-deprecated.tsx
+++ b/packages/web/app/src/pages/target-explorer-deprecated.tsx
@@ -307,7 +307,10 @@ function DeprecatedSchemaExplorer(props: {
/>
>
) : (
-
+
)}
>
)}
diff --git a/packages/web/app/src/pages/target-explorer-type.tsx b/packages/web/app/src/pages/target-explorer-type.tsx
index 3b24a3f0e2..7e7343c4cd 100644
--- a/packages/web/app/src/pages/target-explorer-type.tsx
+++ b/packages/web/app/src/pages/target-explorer-type.tsx
@@ -267,7 +267,10 @@ function TypeExplorerPageContent(props: {
styleDeprecated
/>
) : type ? (
-
+
) : (
Not found
)}
diff --git a/packages/web/app/src/pages/target-explorer-unused.tsx b/packages/web/app/src/pages/target-explorer-unused.tsx
index ea71863ffd..f75ff1caf0 100644
--- a/packages/web/app/src/pages/target-explorer-unused.tsx
+++ b/packages/web/app/src/pages/target-explorer-unused.tsx
@@ -359,7 +359,10 @@ function UnusedSchemaExplorer(props: {
/>
>
) : (
-
+
)}
>
)}
diff --git a/packages/web/app/src/pages/target-explorer.tsx b/packages/web/app/src/pages/target-explorer.tsx
index 30c4622e5a..857a1b0351 100644
--- a/packages/web/app/src/pages/target-explorer.tsx
+++ b/packages/web/app/src/pages/target-explorer.tsx
@@ -273,7 +273,10 @@ function ExplorerPageContent(props: {
) : latestSchemaVersion ? (
noValidSchemaVersion
) : (
-
+
)}
>
)}
diff --git a/packages/web/app/src/pages/target-history.tsx b/packages/web/app/src/pages/target-history.tsx
index fc3b38a0ea..90e71a6d0c 100644
--- a/packages/web/app/src/pages/target-history.tsx
+++ b/packages/web/app/src/pages/target-history.tsx
@@ -273,7 +273,10 @@ function HistoryPageContent(props: {
Recently published schemas.
{query.fetching ? null : (
-
+
)}
);
diff --git a/packages/web/app/src/pages/target.tsx b/packages/web/app/src/pages/target.tsx
index 66d5c23841..b43a3fb6c1 100644
--- a/packages/web/app/src/pages/target.tsx
+++ b/packages/web/app/src/pages/target.tsx
@@ -169,7 +169,7 @@ function SchemaView(props: {
const { latestSchemaVersion } = target;
if (!latestSchemaVersion) {
- return ;
+ return ;
}
if (!latestSchemaVersion.schemas.nodes.length) {
From 57b4608051742b8ce9f0276ca8d796c1e04aa087 Mon Sep 17 00:00:00 2001
From: jdolle <1841898+jdolle@users.noreply.github.com>
Date: Tue, 11 Mar 2025 13:24:31 -0700
Subject: [PATCH 09/16] Revert changeset
---
.changeset/neat-ladybugs-pay.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.changeset/neat-ladybugs-pay.md b/.changeset/neat-ladybugs-pay.md
index 79e2811137..cf066fa5d1 100644
--- a/.changeset/neat-ladybugs-pay.md
+++ b/.changeset/neat-ladybugs-pay.md
@@ -1,5 +1,5 @@
---
-'hive': minor
+'hive': major
---
Add organization access tokens; a new way to issue access tokens for performing actions with the CLI
From 60c2aa7b39326db77a5e9a623ef121b65e2853bc Mon Sep 17 00:00:00 2001
From: jdolle <1841898+jdolle@users.noreply.github.com>
Date: Tue, 11 Mar 2025 13:27:04 -0700
Subject: [PATCH 10/16] Fix typecheck
---
packages/web/app/src/components/ui/empty-list.tsx | 1 -
packages/web/app/src/pages/target-explorer-unused.tsx | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/packages/web/app/src/components/ui/empty-list.tsx b/packages/web/app/src/components/ui/empty-list.tsx
index d8d17fcb3a..f1a5037954 100644
--- a/packages/web/app/src/components/ui/empty-list.tsx
+++ b/packages/web/app/src/components/ui/empty-list.tsx
@@ -6,7 +6,6 @@ import { InlineCode } from '../v2/inline-code';
import { Card } from './card';
import { DocsLink } from './docs-note';
import { Heading } from './heading';
-import { InputCopy } from './input-copy';
export const EmptyList = ({
title,
diff --git a/packages/web/app/src/pages/target-explorer-unused.tsx b/packages/web/app/src/pages/target-explorer-unused.tsx
index f75ff1caf0..37d5eafce5 100644
--- a/packages/web/app/src/pages/target-explorer-unused.tsx
+++ b/packages/web/app/src/pages/target-explorer-unused.tsx
@@ -361,7 +361,7 @@ function UnusedSchemaExplorer(props: {
) : (
)}
>
From eb353a7b7d6f423c492b0caa0bc72b9460a36720 Mon Sep 17 00:00:00 2001
From: jdolle <1841898+jdolle@users.noreply.github.com>
Date: Wed, 12 Mar 2025 23:01:47 -0700
Subject: [PATCH 11/16] implement new code component
---
packages/web/app/src/components/ui/code.tsx | 46 +++++++++++++++++++
.../web/app/src/components/ui/empty-list.tsx | 14 +++---
packages/web/app/src/components/ui/icon.tsx | 6 +--
packages/web/app/src/lib/hooks/use-hover.ts | 39 ++++++++++++++++
packages/web/app/src/lib/hooks/use-timed.ts | 14 ++++++
5 files changed, 109 insertions(+), 10 deletions(-)
create mode 100644 packages/web/app/src/components/ui/code.tsx
create mode 100644 packages/web/app/src/lib/hooks/use-hover.ts
create mode 100644 packages/web/app/src/lib/hooks/use-timed.ts
diff --git a/packages/web/app/src/components/ui/code.tsx b/packages/web/app/src/components/ui/code.tsx
new file mode 100644
index 0000000000..16bd4cb497
--- /dev/null
+++ b/packages/web/app/src/components/ui/code.tsx
@@ -0,0 +1,46 @@
+import { CheckIcon, CopyIcon } from './icon';
+import cn from 'clsx'
+import type { ComponentProps, FC } from 'react'
+import { useHover } from '@/lib/hooks/use-hover';
+import { useTimed } from '@/lib/hooks/use-timed';
+
+export const Code: FC<
+ ComponentProps<'code'>
+> = ({ children, className, ...props }) => {
+ const [copied, startCopyTimer] = useTimed(1500);
+ const [ref, hovering] = useHover();
+ return (
+
+
+ {children}
+
+
+
+ )
+}
diff --git a/packages/web/app/src/components/ui/empty-list.tsx b/packages/web/app/src/components/ui/empty-list.tsx
index f1a5037954..f4fbe6eb6f 100644
--- a/packages/web/app/src/components/ui/empty-list.tsx
+++ b/packages/web/app/src/components/ui/empty-list.tsx
@@ -2,10 +2,10 @@ import { ReactElement, ReactNode } from 'react';
import magnifier from '../../../public/images/figures/magnifier.svg?url';
import { ProjectType } from '@/gql/graphql';
import { cn } from '@/lib/utils';
-import { InlineCode } from '../v2/inline-code';
import { Card } from './card';
import { DocsLink } from './docs-note';
import { Heading } from './heading';
+import { Code } from './code';
export const EmptyList = ({
title,
@@ -68,9 +68,9 @@ export const NoSchemaVersion = ({
registry before publishing.
-
--url ' : ''}`}
- />
+
+ {`hive schema:check ${isDistributed ? '--service --url ' : ''}`}
+
>
);
@@ -84,9 +84,9 @@ export const NoSchemaVersion = ({
)}
-
--url ' : ''}`}
- />
+
+ {`hive schema:publish ${isDistributed ? '--service --url ' : ''}`}
+
>
);
diff --git a/packages/web/app/src/components/ui/icon.tsx b/packages/web/app/src/components/ui/icon.tsx
index 7cd76d6302..b94ad81f4a 100644
--- a/packages/web/app/src/components/ui/icon.tsx
+++ b/packages/web/app/src/components/ui/icon.tsx
@@ -231,11 +231,11 @@ export const ArrowDownIcon = ({ className }: IconProps): ReactElement => (
);
-export const CheckIcon = ({ className }: IconProps): ReactElement => (
+export const CheckIcon = ({ className, size }: IconProps & { size?: number }): ReactElement => (