Skip to content

Commit

Permalink
fix web minor bugs (#243)
Browse files Browse the repository at this point in the history
* feat: feedback pre wrap (#236)

* fix: css

* fix: min width in issue table

* fix: tooltip, feedback space and newline and disable key in field setting (#223)

* fix: remote portal in tooltip, add whitespace-pre-lin in feedback detail

* fix: disable key in field setting

* fix feedback table search bugs

* fix muti-select option order in feedback table
  • Loading branch information
chiol authored Apr 2, 2024
1 parent b9d41f1 commit e563c66
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 33 deletions.
10 changes: 6 additions & 4 deletions apps/web/src/components/etc/ExpandableText/ExpandableText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@
* under the License.
*/

import classNames from 'classnames';

interface IProps extends React.PropsWithChildren {
isExpanded?: boolean;
}

const ExpandableText: React.FC<IProps> = ({ children, isExpanded }) => {
return (
<p
className={
'cursor-text ' +
(isExpanded ? 'whitespace-normal break-all' : 'truncate')
}
className={classNames('cursor-text', {
'whitespace-pre-wrap break-all': isExpanded,
truncate: !isExpanded,
})}
>
{children}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@ interface IProps extends React.PropsWithChildren {
data?: FieldRowType;
disabled?: boolean;
fieldRows: FieldRowType[];
isInput?: boolean;
}

const FieldSettingPopover: React.FC<IProps> = (props) => {
const { onSave, data, disabled, fieldRows, isInput } = props;
const { onSave, data, disabled, fieldRows } = props;

const { t } = useTranslation();
const [open, setOpen] = useState(false);
Expand Down Expand Up @@ -224,7 +223,7 @@ const FieldSettingPopover: React.FC<IProps> = (props) => {
<Input
label="Key"
{...register('key')}
disabled={isInput && data?.type === 'API'}
disabled={isOriginalData}
isSubmitted={formState.isSubmitted}
isSubmitting={formState.isSubmitting}
isValid={!formState.errors.key}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ const FeedbackCell: React.FC<IProps> = memo((props) => {
dayjs(value as string).format(DATE_TIME_FORMAT)
) : field.format === 'multiSelect' ? (
(value as string[])
.sort(
(aKey, bKey) =>
(field.options ?? []).findIndex((option) => option.key === aKey) -
(field.options ?? []).findIndex((option) => option.key === bKey),
)
.map(
(key) =>
field.options?.find((option) => option.key === key)?.name ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* under the License.
*/
import { useRef } from 'react';
import clsx from 'clsx';
import { useTranslation } from 'react-i18next';

import { Icon } from '@ufb/ui';
Expand All @@ -31,9 +32,10 @@ const FeedbackDetailCell: React.FC<IProps> = ({ children }) => {
return (
<td className="pl-2" colSpan={3}>
<div
className={`font-14-regular text-primary break-words break-all align-top ${
!isShowingMore && 'line-clamp-6'
}`}
className={clsx(
'font-14-regular text-primary whitespace-pre-wrap break-words break-all align-top',
{ 'line-clamp-6': !isShowingMore },
)}
ref={ref}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ const FeedbackTable: React.FC<IFeedbackTableProps> = (props) => {
if (field.format === 'number') {
draft[key] = Number(value);
}
if (field.format === 'multiSelect') {
draft[key] = [String(value)];
}
}
});
}
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/containers/tables/IssueTable/IssueTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const getColumns = (t: TFunction, issueTracker?: IssueTrackerType) => [
header: 'Feedback Count',
cell: ({ getValue }) => getValue().toLocaleString(),
size: 160,
minSize: 150,
minSize: 100,
}),
columnHelper.accessor('description', {
header: 'Description',
Expand All @@ -127,6 +127,7 @@ const getColumns = (t: TFunction, issueTracker?: IssueTrackerType) => [
),
enableSorting: false,
size: 300,
minSize: 100,
}),
columnHelper.accessor('status', {
header: 'Status',
Expand Down
40 changes: 18 additions & 22 deletions packages/ufb-ui/src/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
autoUpdate,
flip,
FloatingArrow,
FloatingPortal,
offset,
shift,
useDismiss,
Expand Down Expand Up @@ -208,27 +207,24 @@ export const TooltipContent = React.forwardRef<
}, [color]);

if (!context.open) return null;

return (
<FloatingPortal>
<div
ref={ref}
style={{ ...context.floatingStyles, ...style }}
className={[
'font-12-regular z-40 min-w-[50px] rounded p-2',
bgCN,
textCN,
className,
].join(' ')}
{...context.getFloatingProps(props)}
>
{props.children}
<FloatingArrow
ref={context.arrowRef}
context={context.context}
className={arrowCN}
/>
</div>
</FloatingPortal>
<div
ref={ref}
style={{ ...context.floatingStyles, ...style }}
className={[
'font-12-regular z-40 min-w-[50px] rounded p-2',
bgCN,
textCN,
className,
].join(' ')}
{...context.getFloatingProps(props)}
>
{props.children}
<FloatingArrow
ref={context.arrowRef}
context={context.context}
className={arrowCN}
/>
</div>
);
});

0 comments on commit e563c66

Please sign in to comment.