diff --git a/web/app/components/base/auto-height-textarea/common.tsx b/web/app/components/base/auto-height-textarea/common.tsx index c71df04395..98ff0b7272 100644 --- a/web/app/components/base/auto-height-textarea/common.tsx +++ b/web/app/components/base/auto-height-textarea/common.tsx @@ -49,4 +49,6 @@ const AutoHeightTextarea = forwardRef { +const Switch = React.forwardRef(({ onChange, size = 'md', defaultValue = false, disabled = false, className }: SwitchProps, ref) => { const [enabled, setEnabled] = useState(defaultValue) useEffect(() => { setEnabled(defaultValue) @@ -38,6 +38,7 @@ const Switch = ({ onChange, size = 'md', defaultValue = false, disabled = false, } return ( { if (disabled) @@ -63,5 +64,8 @@ const Switch = ({ onChange, size = 'md', defaultValue = false, disabled = false, /> ) -} +}) + +Switch.displayName = 'Switch' + export default React.memo(Switch) diff --git a/web/app/components/datasets/chunk.tsx b/web/app/components/datasets/chunk.tsx index a53ffdaef9..0ecc91abf1 100644 --- a/web/app/components/datasets/chunk.tsx +++ b/web/app/components/datasets/chunk.tsx @@ -29,9 +29,9 @@ export const ChunkContainer: FC = (props) => { const { label, characterCount, children } = props return
-

+

{children} -

+
} diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index 81fe80f67d..20429cf0a9 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -1086,6 +1086,7 @@ const StepTwo = ({ label={`C-${indexForLabel}`} text={child} tooltip={`Child-chunk-${indexForLabel} ยท ${child.length} Characters`} + labelInnerClassName='text-[10px] font-semibold align-bottom leading-7' /> ) })} diff --git a/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx b/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx index fd35c0c81e..f862e82a0c 100644 --- a/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx +++ b/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx @@ -137,7 +137,7 @@ const ChildSegmentList: FC = ({ {((isFullDocMode && !isLoading) || !collapsed) ?
{isParagraphMode && ( -
+
)} @@ -151,8 +151,9 @@ const ChildSegmentList: FC = ({ text={childChunk.content} onDelete={() => onDelete?.(childChunk.segment_id, childChunk.id)} className='line-clamp-3' - labelClassName='font-semibold' - contentClassName={'!leading-6'} + labelInnerClassName='text-[10px] font-semibold align-bottom leading-6' + contentClassName='!leading-6' + showDivider={false} onClick={(e) => { e.stopPropagation() onClickSlice?.(childChunk) diff --git a/web/app/components/datasets/documents/detail/completed/segment-detail.tsx b/web/app/components/datasets/documents/detail/completed/segment-detail.tsx index bc679222de..0bd8aaa8ea 100644 --- a/web/app/components/datasets/documents/detail/completed/segment-detail.tsx +++ b/web/app/components/datasets/documents/detail/completed/segment-detail.tsx @@ -133,7 +133,11 @@ const SegmentDetail: FC = ({
-
+
void - labelClassName?: string + labelInnerClassName?: string contentClassName?: string + showDivider?: boolean }> export const EditSlice: FC = (props) => { - const { label, className, text, onDelete, labelClassName, contentClassName, ...rest } = props + const { + label, + className, + text, + onDelete, + labelInnerClassName, + contentClassName, + showDivider = true, + ...rest + } = props const [delBtnShow, setDelBtnShow] = useState(false) const [isDelBtnHover, setDelBtnHover] = useState(false) @@ -37,7 +47,7 @@ export const EditSlice: FC = (props) => { const isDestructive = delBtnShow && isDelBtnHover return ( -
+ = (props) => { {label} @@ -59,11 +69,11 @@ export const EditSlice: FC = (props) => { > {text} - + />} {delBtnShow && @@ -88,6 +98,6 @@ export const EditSlice: FC = (props) => {
} -
+ ) } diff --git a/web/app/components/datasets/formatted-text/flavours/preview-slice.tsx b/web/app/components/datasets/formatted-text/flavours/preview-slice.tsx index 9b7ec026f3..e9fd72e3c0 100644 --- a/web/app/components/datasets/formatted-text/flavours/preview-slice.tsx +++ b/web/app/components/datasets/formatted-text/flavours/preview-slice.tsx @@ -7,10 +7,11 @@ import { SliceContainer, SliceContent, SliceDivider, SliceLabel } from './shared type PreviewSliceProps = SliceProps<{ label: ReactNode tooltip: ReactNode + labelInnerClassName?: string }> export const PreviewSlice: FC = (props) => { - const { label, className, text, tooltip, ...rest } = props + const { label, className, text, tooltip, labelInnerClassName, ...rest } = props const [tooltipOpen, setTooltipOpen] = useState(false) const { refs, floatingStyles, context } = useFloating({ open: tooltipOpen, @@ -37,7 +38,7 @@ export const PreviewSlice: FC = (props) => { ref={refs.setReference} {...getReferenceProps()} > - {label} + {label} {text} diff --git a/web/app/components/datasets/formatted-text/flavours/shared.tsx b/web/app/components/datasets/formatted-text/flavours/shared.tsx index 0ce17db7e4..f130391e62 100644 --- a/web/app/components/datasets/formatted-text/flavours/shared.tsx +++ b/web/app/components/datasets/formatted-text/flavours/shared.tsx @@ -14,16 +14,18 @@ export const SliceContainer: FC = forwardRef((props, ref) = }) SliceContainer.displayName = 'SliceContainer' -export type SliceLabelProps = ComponentProps<'span'> +export type SliceLabelProps = ComponentProps<'span'> & { labelInnerClassName?: string } export const SliceLabel: FC = forwardRef((props, ref) => { - const { className, children, ...rest } = props + const { className, children, labelInnerClassName, ...rest } = props return - {children} + + {children} + }) SliceLabel.displayName = 'SliceLabel' @@ -47,7 +49,8 @@ export type SliceDividerProps = ComponentProps<'span'> export const SliceDivider: FC = forwardRef((props, ref) => { const { className, ...rest } = props return {/* use a zero-width space to make the hover area bigger */}