mirror of
https://github.com/langgenius/dify.git
synced 2026-09-05 08:48:10 +08:00
Co-authored-by: fatelei <fatelei@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
'use client'
|
|
|
|
import { Switch } from '@langgenius/dify-ui/switch'
|
|
import { memo, useId } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
type AutomaticIncludeWorkspaceMembersSectionProps = {
|
|
checked?: boolean
|
|
loading: boolean
|
|
onChange?: (checked: boolean) => void
|
|
}
|
|
|
|
function AutomaticIncludeWorkspaceMembersSection({
|
|
checked,
|
|
loading,
|
|
onChange,
|
|
}: AutomaticIncludeWorkspaceMembersSectionProps) {
|
|
const { t } = useTranslation()
|
|
const labelId = useId()
|
|
const descriptionId = useId()
|
|
|
|
return (
|
|
<section className="flex min-h-21 items-center gap-4 rounded-xl border border-components-panel-border bg-background-default-subtle p-4">
|
|
<div className="min-w-0 flex-1">
|
|
<h2 id={labelId} className="system-sm-semibold text-text-secondary">
|
|
{t(($) => $['accessRule.automaticallyIncludeWorkspaceMembers'], {
|
|
ns: 'permission',
|
|
})}
|
|
</h2>
|
|
<p id={descriptionId} className="mt-0.5 system-xs-regular text-text-tertiary">
|
|
{t(($) => $['accessRule.automaticallyIncludeWorkspaceMembersDescription'], {
|
|
ns: 'permission',
|
|
})}
|
|
</p>
|
|
</div>
|
|
<Switch
|
|
size="lg"
|
|
checked={checked ?? false}
|
|
disabled={checked === undefined || !onChange}
|
|
loading={loading}
|
|
aria-labelledby={labelId}
|
|
aria-describedby={descriptionId}
|
|
onCheckedChange={onChange}
|
|
/>
|
|
</section>
|
|
)
|
|
}
|
|
|
|
export default memo(AutomaticIncludeWorkspaceMembersSection)
|