- Notifications
You must be signed in to change notification settings - Fork928
feat: implement CRUD UI for IDP organization sync settings#15503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
d0baa8c
6463076
f714986
072d775
f6e286c
acf8cbe
ad1aa84
b01588d
6203d04
bc37998
2c2246d
6971f91
6e87130
a1b6e79
36c8706
a4e66c2
f7be49f
90a65fe
c282765
40155bc
a129820
8edd4b4
e54e5ca
bb16bd1
678a91d
a13d9b2
1b8efd1
137c25c
46a4646
85a455c
a9e06f1
d921b08
ba665b4
8a0e789
234c0fb
7d88a38
c6c9b16
5322a4e
eab8a0d
721d5d4
8986cbd
89a7b12
148dca7
0c338b0
0cadc8b
1d7153b
a914c54
bd307c0
95bfd17
82bd850
6eb6987
3822b2e
fe17b1c
e75e179
c6e07ff
a3b9b27
0601164
b01e5d3
1c5b6ef
6e2ee08
ae30db0
ac74cdc
a99dca5
4c00959
568a5a9
c313439
506223d
f223ab7
94ff4ca
9101e0e
5ca2c0c
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -16,5 +16,6 @@ | ||
"ui": "/components/ui", | ||
"lib": "/lib", | ||
"hooks": "/hooks" | ||
}, | ||
"iconLibrary": "lucide" | ||
} |
Large diffs are not rendered by default.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { API } from "api/api"; | ||
import type { OrganizationSyncSettings } from "api/typesGenerated"; | ||
import type { QueryClient } from "react-query"; | ||
export const getOrganizationIdpSyncSettingsKey = () => [ | ||
"organizationIdpSyncSettings", | ||
]; | ||
export const patchOrganizationSyncSettings = (queryClient: QueryClient) => { | ||
return { | ||
mutationFn: (request: OrganizationSyncSettings) => | ||
API.patchOrganizationIdpSyncSettings(request), | ||
onSuccess: async () => | ||
await queryClient.invalidateQueries(getOrganizationIdpSyncSettingsKey()), | ||
}; | ||
}; | ||
export const organizationIdpSyncSettings = (isIdpSyncEnabled: boolean) => { | ||
return { | ||
queryKey: getOrganizationIdpSyncSettingsKey(), | ||
queryFn: () => API.getOrganizationIdpSyncSettings(), | ||
enabled: isIdpSyncEnabled, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { Badge } from "./Badge"; | ||
const meta: Meta<typeof Badge> = { | ||
title: "components/Badge", | ||
component: Badge, | ||
args: { | ||
children: "Badge", | ||
}, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<typeof Badge>; | ||
export const Default: Story = {}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copied from shadc/ui on 11/13/2024 | ||
* @see {@link https://ui.shadcn.com/docs/components/badge} | ||
*/ | ||
import { type VariantProps, cva } from "class-variance-authority"; | ||
import type { FC } from "react"; | ||
import { cn } from "utils/cn"; | ||
export const badgeVariants = cva( | ||
"inline-flex items-center rounded-md border px-2.5 py-1 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", | ||
{ | ||
variants: { | ||
variant: { | ||
default: | ||
"border-transparent bg-surface-secondary text-content-secondary shadow hover:bg-surface-tertiary", | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: "default", | ||
}, | ||
}, | ||
); | ||
export interface BadgeProps | ||
extends React.HTMLAttributes<HTMLDivElement>, | ||
VariantProps<typeof badgeVariants> {} | ||
export const Badge: FC<BadgeProps> = ({ className, variant, ...props }) => { | ||
return ( | ||
<div className={cn(badgeVariants({ variant }), className)} {...props} /> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { Trash } from "lucide-react"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. does this bring inall of lucide? how does this affect our bundle size? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Only the icons that are used,https://lucide.dev/guide/#code-optimization | ||
import { Button } from "./Button"; | ||
const meta: Meta<typeof Button> = { | ||
title: "components/Button", | ||
component: Button, | ||
args: { | ||
children: ( | ||
<> | ||
<Trash /> | ||
Button | ||
</> | ||
), | ||
}, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<typeof Button>; | ||
export const Default: Story = {}; | ||
export const Outline: Story = { | ||
args: { | ||
variant: "outline", | ||
}, | ||
}; | ||
export const Subtle: Story = { | ||
args: { | ||
variant: "subtle", | ||
}, | ||
}; | ||
export const Warning: Story = { | ||
args: { | ||
variant: "warning", | ||
}, | ||
}; | ||
export const DefaultDisabled: Story = { | ||
args: { | ||
disabled: true, | ||
}, | ||
}; | ||
export const OutlineDisabled: Story = { | ||
args: { | ||
variant: "outline", | ||
disabled: true, | ||
}, | ||
}; | ||
export const SubtleDisabled: Story = { | ||
args: { | ||
variant: "subtle", | ||
disabled: true, | ||
}, | ||
}; | ||
export const IconButtonDefault: Story = { | ||
args: { | ||
variant: "default", | ||
children: <Trash />, | ||
}, | ||
}; | ||
export const IconButtonOutline: Story = { | ||
args: { | ||
variant: "outline", | ||
children: <Trash />, | ||
}, | ||
}; | ||
export const IconButtonSubtle: Story = { | ||
args: { | ||
variant: "subtle", | ||
children: <Trash />, | ||
}, | ||
}; |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.