Skip to content

Commit a8aa908

Browse files
committed
clean up
1 parent e1ce7f7 commit a8aa908

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+681
-1483
lines changed

pnpm-lock.yaml

Lines changed: 199 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/common/eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default tseslint.config(
1010
tseslint.configs.recommended,
1111
{
1212
rules: {
13-
'@typescript-eslint/no-explicit-any': 'off',
1413
'@typescript-eslint/no-unused-vars': 'off',
1514
'@typescript-eslint/no-empty-object-type': 'off',
1615
'@typescript-eslint/no-unused-expressions': 'off',

web/common/package.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,45 @@
33
"version": "0.0.1",
44
"devDependencies": {
55
"@eslint/js": "^9.31.0",
6-
"@radix-ui/react-slot": "^1.2.3",
7-
"@radix-ui/react-tooltip": "^1.2.8",
86
"@radix-ui/react-dialog": "^1.1.15",
97
"@radix-ui/react-dropdown-menu": "^2.1.16",
108
"@radix-ui/react-popover": "^1.1.15",
11-
"@tanstack/react-virtual": "^3.13.12",
12-
"cmdk": "^1.1.1",
13-
"fuse.js": "^7.1.0",
9+
"@radix-ui/react-slot": "^1.2.3",
10+
"@radix-ui/react-tooltip": "^1.2.8",
1411
"@storybook/addon-docs": "^9.1.5",
1512
"@storybook/addon-onboarding": "^9.1.5",
1613
"@storybook/react-vite": "^9.1.5",
1714
"@tailwindcss/typography": "^0.5.16",
15+
"@tanstack/react-virtual": "^3.13.12",
1816
"@testing-library/dom": "^10.4.1",
1917
"@testing-library/jest-dom": "^6.6.3",
2018
"@testing-library/react": "^16.3.0",
2119
"@types/node": "^20.11.25",
2220
"@types/react": "^18.3.23",
2321
"@types/react-dom": "^18.3.7",
22+
"@types/react-syntax-highlighter": "^15.5.13",
2423
"@vitejs/plugin-react": "^4.7.0",
2524
"@vitest/browser": "^3.2.4",
2625
"@xyflow/react": "^12.8.4",
2726
"autoprefixer": "^10.4.21",
2827
"class-variance-authority": "^0.7.1",
2928
"clsx": "^2.1.1",
29+
"cmdk": "^1.1.1",
3030
"eslint": "^9.31.0",
3131
"eslint-plugin-react-hooks": "^5.2.0",
3232
"eslint-plugin-storybook": "^9.1.5",
33+
"fuse.js": "^7.1.0",
3334
"globals": "^16.3.0",
3435
"lucide-react": "^0.542.0",
3536
"playwright": "^1.54.1",
3637
"postcss": "^8.5.6",
3738
"react": "^18.3.1",
3839
"react-dom": "^18.3.1",
40+
"react-syntax-highlighter": "^15.6.6",
3941
"storybook": "^9.1.5",
4042
"syncpack": "^13.0.4",
4143
"tailwind-merge": "^3.3.1",
42-
"tailwind-scrollbar": "^4.0.2",
44+
"tailwind-scrollbar": "^3.1.0",
4345
"tailwindcss": "^3.4.17",
4446
"typescript": "^5.8.3",
4547
"typescript-eslint": "^8.38.0",
@@ -70,18 +72,18 @@
7072
"main": "dist/sqlmesh-common.umd.js",
7173
"module": "dist/sqlmesh-common.es.js",
7274
"peerDependencies": {
73-
"@radix-ui/react-slot": "^1.2.3",
74-
"@radix-ui/react-tooltip": "^1.2.8",
7575
"@radix-ui/react-dialog": "^1.1.15",
7676
"@radix-ui/react-dropdown-menu": "^2.1.16",
7777
"@radix-ui/react-popover": "^1.1.15",
78-
"@tanstack/react-virtual": "^3.13.12",
79-
"cmdk": "^1.1.1",
80-
"fuse.js": "^7.1.0",
78+
"@radix-ui/react-slot": "^1.2.3",
79+
"@radix-ui/react-tooltip": "^1.2.8",
8180
"@tailwindcss/typography": "^0.5.16",
81+
"@tanstack/react-virtual": "^3.13.12",
8282
"@xyflow/react": "^12.8.4",
8383
"class-variance-authority": "^0.7.1",
8484
"clsx": "^2.1.1",
85+
"cmdk": "^1.1.1",
86+
"fuse.js": "^7.1.0",
8587
"lucide-react": "^0.542.0",
8688
"react": "^18.3.1",
8789
"react-dom": "^18.3.1",

web/common/src/components/Badge/Badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
1818
const Comp = asChild ? Slot : 'span'
1919
return (
2020
<Comp
21+
data-component="Badge"
2122
className={cn(badgeVariants({ size, shape, className }))}
2223
ref={ref}
23-
data-component="Badge"
2424
{...props}
2525
/>
2626
)

web/common/src/components/Button/Button.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
2828
const Comp = asChild ? Slot : 'button'
2929
return (
3030
<Comp
31+
data-component="Button"
3132
className={cn(
3233
buttonVariants({ variant, size, className }),
3334
disabled && 'pointer-events-none bg-neutral-150 text-prose',
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import type { Meta, StoryObj } from '@storybook/react-vite'
2+
import { expect, within, userEvent, fn } from 'storybook/test'
3+
import { Code } from './Code'
4+
5+
const meta: Meta<typeof Code> = {
6+
title: 'Components/Code',
7+
component: Code,
8+
}
9+
10+
export default meta
11+
12+
type Story = StoryObj<typeof Code>
13+
14+
export const Default: Story = {
15+
args: {
16+
content: `MODEL (
17+
name tier1.compliance_application_affiliated_person,
18+
owner 'data-infra',
19+
start '2023-01-01',
20+
cron '0 */4 * * *',
21+
tags (creditrisk, tier1_mart),
22+
dialect bigquery,
23+
kind VIEW (
24+
materialized FALSE
25+
),
26+
virtual_environment_mode 'full'
27+
)
28+
SELECT
29+
compliance_application_affiliated_person_internal_id,
30+
compliance_application_affiliated_person_id,
31+
effective_at,
32+
updated_at,
33+
business_affiliated_person_internal_id,
34+
status,
35+
address_city,
36+
address_country,
37+
address_line1,
38+
address_line2,
39+
address_post_code,
40+
address_state,
41+
birth_date,
42+
email,
43+
first_name,
44+
ip_address,
45+
last_name,
46+
middle_name,
47+
phone_nr,
48+
ssn,
49+
tags,
50+
alloy_entity_external_id,
51+
compliance_application_internal_id,
52+
is_ubo,
53+
is_control_person,
54+
datastream_metadata__uuid,
55+
datastream_metadata__source_timestamp
56+
FROM tier1.stg_pg__compliance_application_affiliated_persons
57+
`,
58+
},
59+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { cn } from '@/utils'
2+
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter'
3+
import { vs } from 'react-syntax-highlighter/dist/esm/styles/hljs'
4+
import { CopyButton } from '../CopyButton/CopyButton'
5+
import { VerticalContainer } from '../VerticalContainer/VerticalContainer'
6+
7+
export function Code({
8+
content,
9+
language = 'sql',
10+
className,
11+
hideNumbers = false,
12+
wrap = false,
13+
showCopy = true,
14+
}: {
15+
content: string
16+
language?: 'sql' | 'python' | 'yaml' | 'json' | 'diff'
17+
hideNumbers?: boolean
18+
wrap?: boolean
19+
showCopy?: boolean
20+
className?: string
21+
}) {
22+
return (
23+
<VerticalContainer
24+
data-component="Code"
25+
className={cn(
26+
'relative p-2 rounded-2xl border border-neutral-10 font-mono text-xs',
27+
className,
28+
)}
29+
>
30+
{showCopy && (
31+
<div className="flex justify-end flex-shrink-0 absolute top-2 right-4">
32+
<CopyButton text={content}>
33+
{copied => (copied ? 'Copied!' : 'Copy')}
34+
</CopyButton>
35+
</div>
36+
)}
37+
<VerticalContainer scroll>
38+
<SyntaxHighlighter
39+
language={language}
40+
style={vs}
41+
showLineNumbers={!hideNumbers}
42+
wrapLines={wrap}
43+
>
44+
{content}
45+
</SyntaxHighlighter>
46+
</VerticalContainer>
47+
</VerticalContainer>
48+
)
49+
}

web/common/src/components/CopyButton/CopyButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const CopyButton = React.forwardRef<HTMLButtonElement, CopyButtonProps>(
4545
return (
4646
<Button
4747
ref={ref}
48+
data-component="CopyButton"
4849
title={title}
4950
size={size}
5051
variant={variant}

web/common/src/components/ErrorContainer/ErrorContainer.stories.tsx

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

0 commit comments

Comments
 (0)