Skip to content

Commit

Permalink
feat: openid client v6 with more other improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
antosubash committed Oct 31, 2024
1 parent 2ddc9eb commit 6f1eb8a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 61 deletions.
10 changes: 3 additions & 7 deletions src/src/components/settings/Features.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { useFeatures } from '@/lib/hooks/useFeatures'
import { PermissionProvider } from '@/lib/utils'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { Button } from '../ui/button'
import { Dialog, DialogContent, DialogFooter, DialogTitle } from '../ui/dialog'
import { useToast } from '../ui/use-toast'
import {useEffect, useState} from 'react'
import {Button} from '../ui/button'
import {Dialog, DialogContent, DialogFooter, DialogTitle} from '../ui/dialog'

type FeaturesProps = {
onDismiss: () => void
Expand Down
21 changes: 10 additions & 11 deletions src/src/components/settings/TestEmail.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { SendTestEmailInput, emailSettingsSendTestEmail } from '@/client'
import { QueryNames } from '@/lib/hooks/QueryConstants'
import { useGrantedPolicies } from '@/lib/hooks/useGrantedPolicies'
import { useQueryClient } from '@tanstack/react-query'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import { Button } from '../ui/button'
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '../ui/dialog'
import { Input } from '../ui/input'
import { Textarea } from '../ui/textarea'
import { useToast } from '../ui/use-toast'
import {emailSettingsSendTestEmail, SendTestEmailInput} from '@/client'
import {QueryNames} from '@/lib/hooks/QueryConstants'
import {useQueryClient} from '@tanstack/react-query'
import {useEffect, useState} from 'react'
import {useForm} from 'react-hook-form'
import {Button} from '../ui/button'
import {Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle} from '../ui/dialog'
import {Input} from '../ui/input'
import {Textarea} from '../ui/textarea'
import {useToast} from '../ui/use-toast'

export type TestEmailProps = {
onDismiss: () => void
Expand Down
80 changes: 37 additions & 43 deletions src/src/components/ui/toggle-group.tsx
Original file line number Diff line number Diff line change
@@ -1,61 +1,55 @@
"use client"
'use client'

import * as React from "react"
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
import {type VariantProps} from "class-variance-authority"
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'
import { VariantProps } from 'class-variance-authority'
import * as React from 'react'

import {cn} from "@/lib/utils"
import {toggleVariants} from "@/components/ui/toggle"
import { toggleVariants } from '@/components/ui/toggle'
import { cn } from '@/lib/utils'

const ToggleGroupContext = React.createContext<
VariantProps<typeof toggleVariants>
>({
size: "default",
variant: "default",
const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants>>({
size: 'default',
variant: 'default',
})

const ToggleGroup = React.forwardRef<
React.ElementRef<typeof ToggleGroupPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
React.ElementRef<typeof ToggleGroupPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
VariantProps<typeof toggleVariants>
>(({ className, variant, size, children, ...props }, ref) => (
<ToggleGroupPrimitive.Root
ref={ref}
className={cn("flex items-center justify-center gap-1", className)}
{...props}
type={props.type || "radio"}
>
<ToggleGroupContext.Provider value={{variant, size}}>
{children}
</ToggleGroupContext.Provider>
</ToggleGroupPrimitive.Root>
<ToggleGroupPrimitive.Root
ref={ref}
className={cn('flex items-center justify-center gap-1', className)}
{...props}
>
<ToggleGroupContext.Provider value={{ variant, size }}>{children}</ToggleGroupContext.Provider>
</ToggleGroupPrimitive.Root>
))

ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName

const ToggleGroupItem = React.forwardRef<
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
VariantProps<typeof toggleVariants>
>(({ className, children, variant, size, ...props }, ref) => {
const context = React.useContext(ToggleGroupContext)

return (
<ToggleGroupPrimitive.Item
ref={ref}
className={cn(
toggleVariants({
variant: context.variant || variant,
size: context.size || size,
}),
className
)}
{...props}
value={props.value}
>
{children}
</ToggleGroupPrimitive.Item>
)
const context = React.useContext(ToggleGroupContext)

return (
<ToggleGroupPrimitive.Item
ref={ref}
className={cn(
toggleVariants({
variant: context.variant || variant,
size: context.size || size,
}),
className
)}
{...props}
>
{children}
</ToggleGroupPrimitive.Item>
)
})

ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
Expand Down

0 comments on commit 6f1eb8a

Please sign in to comment.