fix: replace react-tooltip with AppTooltip and refactor MenuItemAvatar (#17846)
This PR addresses TODO comments and improves code quality: ### 1. PullRequestItem.tsx - Replaced `react-tooltip` with `twenty-ui` `AppTooltip` component - Removed TODO comment - Uses internal component library for consistency ### 2. MenuItemAvatar.tsx - Refactored to use `MenuItem` internally, eliminating code duplication - Removed about 63 lines of duplicate code - Removed TODO comment as the merge is now complete --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
import { Tooltip } from 'react-tooltip';
|
||||
import styled from '@emotion/styled';
|
||||
import { format } from 'date-fns';
|
||||
|
||||
import { PullRequestIcon } from '@/app/_components/ui/icons/SvgIcons';
|
||||
import { Theme } from '@/app/_components/ui/theme/theme';
|
||||
import { formatIntoRelativeDate } from '@/shared-utils/formatIntoRelativeDate';
|
||||
|
||||
// TODO: use twenty-ui Tooltip
|
||||
const StyledTooltip = styled(Tooltip)``;
|
||||
import { AppTooltip } from 'twenty-ui/display';
|
||||
|
||||
const Item = styled.div`
|
||||
display: flex;
|
||||
@@ -89,7 +86,8 @@ export const PullRequestItem = ({
|
||||
<StyledDescription>
|
||||
<StyledPrLink
|
||||
href={'https://github.com/twentyhq/twenty/pull/' + prNumber}
|
||||
target="__blank"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
#{prNumber}
|
||||
</StyledPrLink>{' '}
|
||||
@@ -97,7 +95,7 @@ export const PullRequestItem = ({
|
||||
<span id={`date-${prNumber}`}>
|
||||
{formatIntoRelativeDate(mergedAt ? mergedAt : createdAt)}
|
||||
</span>
|
||||
<StyledTooltip
|
||||
<AppTooltip
|
||||
anchorSelect={`#date-${prNumber}`}
|
||||
content={format(
|
||||
new Date(mergedAt ? mergedAt : createdAt),
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
import { useState } from 'react';
|
||||
import createCache from '@emotion/cache';
|
||||
import { CacheProvider } from '@emotion/react';
|
||||
import { CacheProvider, ThemeProvider } from '@emotion/react';
|
||||
import { useServerInsertedHTML } from 'next/navigation';
|
||||
import { THEME_LIGHT } from 'twenty-ui/theme';
|
||||
|
||||
export default function RootStyleRegistry({
|
||||
children,
|
||||
@@ -47,5 +48,12 @@ export default function RootStyleRegistry({
|
||||
);
|
||||
});
|
||||
|
||||
return <CacheProvider value={cache}>{children}</CacheProvider>;
|
||||
return (
|
||||
<CacheProvider value={cache}>
|
||||
<ThemeProvider theme={THEME_LIGHT}>
|
||||
{/* Cast for ReactNode type compatibility between Next and Emotion's @types/react */}
|
||||
{children as any}
|
||||
</ThemeProvider>
|
||||
</CacheProvider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user