Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(frontend): Kill @ant-design/icons #24817

Merged
merged 5 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ module.exports = {
{
name: 'dayjs',
message: 'Do not directly import dayjs. Only import the dayjs exported from lib/dayjs.',
},
{
name: '@ant-design/icons',
message: 'Please use icons from the @posthog/icons package instead',
},
}
],
},
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 19 additions & 4 deletions frontend/src/lib/components/Cards/CardMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import './CardMeta.scss'

import { IconPieChart } from '@posthog/icons'
import clsx from 'clsx'
import { useResizeObserver } from 'lib/hooks/useResizeObserver'
import { IconRefresh, IconSubtitles, IconSubtitlesOff } from 'lib/lemon-ui/icons'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import React from 'react'
import { Transition } from 'react-transition-group'

import { InsightColor } from '~/types'
Expand All @@ -28,7 +31,7 @@ export interface CardMetaProps extends Pick<React.HTMLAttributes<HTMLDivElement>
metaDetails?: JSX.Element | null
moreButtons?: JSX.Element | null
topHeading?: JSX.Element | null
samplingNotice?: JSX.Element | null
samplingFactor?: number | null
}

export function CardMeta({
Expand All @@ -44,7 +47,7 @@ export function CardMeta({
areDetailsShown,
setAreDetailsShown,
className,
samplingNotice,
samplingFactor,
}: CardMetaProps): JSX.Element {
const { ref: primaryRef, width: primaryWidth } = useResizeObserver()
const { ref: detailsRef, height: detailsHeight } = useResizeObserver()
Expand All @@ -68,7 +71,20 @@ export function CardMeta({
)}
<div className="CardMeta__main">
<div className="CardMeta__top">
<h5>{topHeading}</h5>
<h5>
{topHeading}
{samplingFactor && samplingFactor < 1 && (
<Tooltip
title={`Results calculated from ${100 * samplingFactor}% of users`}
placement="right"
>
<IconPieChart
className="ml-1.5 text-base align-[-0.25em]"
style={{ color: 'var(--primary-3000-hover)' }}
/>
</Tooltip>
)}
</h5>
<div className="CardMeta__controls">
{showDetailsControls && setAreDetailsShown && (
<LemonButton
Expand All @@ -88,7 +104,6 @@ export function CardMeta({
disabledReason={refreshDisabledReason}
/>
)}
{samplingNotice ? samplingNotice : null}
{showEditingControls && <More overlay={moreButtons} />}
</div>
</div>
Expand Down
10 changes: 1 addition & 9 deletions frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// eslint-disable-next-line no-restricted-imports
import { PieChartFilled } from '@ant-design/icons'
import { useValues } from 'kea'
import { CardMeta } from 'lib/components/Cards/CardMeta'
import { TopHeading } from 'lib/components/Cards/InsightCard/TopHeading'
Expand Down Expand Up @@ -128,13 +126,7 @@ export function InsightMeta({
</>
}
metaDetails={<InsightDetails insight={insight} />}
samplingNotice={
samplingFactor && samplingFactor < 1 ? (
<Tooltip title={`Results calculated from ${100 * samplingFactor}% of users`}>
<PieChartFilled className="mr-2" style={{ color: 'var(--primary-3000-hover)' }} />
</Tooltip>
) : null
}
samplingFactor={samplingFactor}
moreButtons={
<>
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line no-restricted-imports
import { FundOutlined } from '@ant-design/icons'
import { IconPulse } from '@posthog/icons'
import { LemonSelect } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { insightLogic } from 'scenes/insights/insightLogic'
Expand All @@ -25,7 +24,8 @@ export function SmoothingFilter(): JSX.Element | null {
label:
value === smoothingIntervals ? (
<>
<FundOutlined className="mr-1 text-muted" /> {label}
<IconPulse className="mr-1.5 text-muted" />
{label}
</>
) : (
label
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/lib/components/TZLabel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import './index.scss'

// eslint-disable-next-line no-restricted-imports
import { LaptopOutlined, ProjectOutlined } from '@ant-design/icons'
import { IconGear } from '@posthog/icons'
import { IconGear, IconHome, IconLaptop } from '@posthog/icons'
import { LemonButton, LemonDivider, LemonDropdown, LemonDropdownProps } from '@posthog/lemon-ui'
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
Expand Down Expand Up @@ -57,7 +55,7 @@ const TZLabelPopoverContent = React.memo(function TZLabelPopoverContent({
<div className="space-y-2">
<div className="TZLabelPopover__row">
<div>
<LaptopOutlined />
<IconLaptop />
</div>
<div>Your device</div>
<div>{shortTimeZone(undefined, time.toDate())}</div>
Expand All @@ -66,7 +64,7 @@ const TZLabelPopoverContent = React.memo(function TZLabelPopoverContent({
{currentTeam && (
<div className="TZLabelPopover__row TZLabelPopover__row--muted">
<div>
<ProjectOutlined />
<IconHome />
</div>
<div>Project</div>
<div>{shortTimeZone(currentTeam.timezone, time.toDate())}</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/queries/nodes/InsightViz/EditorFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export function EditorFilters({ query, showing, embedded }: EditorFiltersProps):
</div>

{shouldShowSessionAnalysisWarning ? (
<LemonBanner type="info">
<LemonBanner type="info" className="mt-2">
When using sessions and session properties, events without session IDs will be excluded from the
set of results.{' '}
<Link to="https://posthog.com/docs/user-guides/sessions">Learn more about sessions.</Link>
Expand Down
20 changes: 13 additions & 7 deletions frontend/src/scenes/insights/EmptyStates/EmptyStates.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import './EmptyStates.scss'

// eslint-disable-next-line no-restricted-imports
import { PlusCircleOutlined, ThunderboltFilled } from '@ant-design/icons'
import { IconArchive, IconInfo, IconPlus, IconWarning } from '@posthog/icons'
import {
IconArchive,
IconInfo,
IconPieChart,
IconPlus,
IconPlusSmall,
IconPlusSquare,
IconWarning,
} from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { AnimationType } from 'lib/animations/animations'
Expand Down Expand Up @@ -69,7 +75,7 @@ function SamplingLink({ insightProps }: { insightProps: InsightLogicProps }): JS
})
}}
>
<ThunderboltFilled className="mt-1" /> {suggestedSamplingPercentage}% sampling
<IconPieChart className="mt-1" /> {suggestedSamplingPercentage}% sampling
</Link>
</Tooltip>
)
Expand Down Expand Up @@ -341,10 +347,10 @@ export function FunnelSingleStepState({ actionable = true }: FunnelSingleStepSta
<div className="insight-empty-state funnels-empty-state">
<div className="empty-state-inner">
<div className="illustration-main">
<PlusCircleOutlined />
<IconPlusSquare />
</div>
<h2 className="text-xl leading-tight funnels-empty-state__title">Add another step!</h2>
<p className="text-sm text-center text-balance">
<p className="mb-0 text-sm text-center text-balance">
You’re almost there! Funnels require at least two steps before calculating.
{actionable &&
' Once you have two steps defined, additional changes will recalculate automatically.'}
Expand Down Expand Up @@ -480,7 +486,7 @@ export function SavedInsightsEmptyState(): JSX.Element {
<LemonButton
type="primary"
data-attr="add-insight-button-empty-state"
icon={<PlusCircleOutlined />}
icon={<IconPlusSmall />}
className="add-insight-button"
>
New insight
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/scenes/saved-insights/SavedInsights.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@
line-height: 1.7rem;
color: var(--muted);
}

button.add-insight-button {
height: 50px;
padding: 0 3rem;
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"mypy-baseline-sync": "mypy -p posthog | mypy-baseline sync"
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@babel/runtime": "^7.24.0",
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/modifiers": "^6.0.1",
Expand Down
43 changes: 5 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading