Skip to content

Commit

Permalink
Merge branch 'master' into dw-virtual-data-warehouse-table-breakdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
EDsCODE authored Mar 19, 2024
2 parents 3b1c1fb + 921d208 commit df4be72
Show file tree
Hide file tree
Showing 9 changed files with 312 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
IconApps,
IconCalculator,
IconChat,
IconCheck,
IconCursor,
IconDashboard,
IconDatabase,
IconDay,
IconDecisionTree,
IconExternal,
IconEye,
IconFunnels,
Expand Down Expand Up @@ -617,7 +617,7 @@ export const commandPaletteLogic = kea<commandPaletteLogicType>([
},
},
{
icon: IconApps,
icon: IconDecisionTree,
display: 'Go to Apps',
synonyms: ['integrations'],
executor: () => {
Expand Down
189 changes: 189 additions & 0 deletions frontend/src/lib/lemon-ui/icons/categories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
export const UNUSED_ICONS = [
'IconAdvanced',
'IconAsterisk',
'IconGridMasonry',
'IconApps',
'IconRibbon',
'IconPulse',
'IconPineapple',
'IconPizza',
'IconTarget',
'IconThumbsUp',
'IconThumbsUpFilled',
'IconThumbsDown',
'IconThumbsDownFilled',
'IconShieldLock',
]

export const OBJECTS = {
Misc: [
'IconPalette',
'IconMegaphone',
'IconRocket',
'IconMap',
'IconTie',
'IconCoffee',
'IconFlag',
'IconCreditCard',
'IconCrown',
'IconBolt',
'IconBook',
'IconConfetti',
'IconPresent',
'IconMagicWand',
'IconMagic',
'IconHelmet',
'IconSpotlight',
'IconGraduationCap',
'IconLightBulb',
'IconBell',
'IconBox',
'IconBuilding',
'IconEye',
'IconFeatures',
'IconHome',
'IconHomeFilled',
'IconGear',
'IconGearFilled',
'IconStack',
],
People: ['IconPeople', 'IconPeopleFilled', 'IconPerson', 'IconProfile', 'IconUser'],
'Business & Finance': ['IconStore', 'IconCart', 'IconReceipt', 'IconPiggyBank'],
Time: ['IconHourglass', 'IconCalendar', 'IconClock'],
Nature: ['IconDay', 'IconNight', 'IconGlobe', 'IconCloud', 'IconBug'],
Text: ['IconDocument', 'IconBrackets', 'IconTextWidth', 'IconQuote', 'IconLetter', 'IconNewspaper'],
}

export const TECHNOLOGY = {
Messaging: ['IconSend', 'IconHeadset', 'IconMessage', 'IconNotification', 'IconChat', 'IconThoughtBubble'],
Hardware: [
'IconLaptop',
'IconPhone',
'IconWebcam',
'IconMicrophone',
'IconKeyboard',
'IconServer',
'IconDatabase',
'IconHardDrive',
],
Software: ['IconBrowser', 'IconCode', 'IconCodeInsert', 'IconTerminal', 'IconApp'],
UI: [
'IconPassword',
'IconToggle',
'IconLoading',
'IconSpinner',
'IconBrightness',
'IconCursor',
'IconCursorBox',
'IconCursorClick',
'IconToolbar',
'IconToolbarFilled',
'IconCheckbox',
'IconList',
'IconColumns',
],
}

export const ELEMENTS = {
Actions: [
'IconCopy',
'IconTrash',
'IconUndo',
'IconRedo',
'IconRevert',
'IconSearch',
'IconUpload',
'IconShare',
'IconDownload',
'IconLeave',
'IconPin',
'IconPinFilled',
'IconPencil',
'IconOpenSidebar',
'IconFilter',
'IconArchive',
'IconSort',
'IconExternal',
],
Symbols: [
'IconLock',
'IconUnlock',
'IconPrivacy',
'IconShield',
'IconWarning',
'IconQuestion',
'IconInfo',
'IconCheckCircle',
'IconCheck',
'IconX',
'IconEllipsis',
],
'Arrows & Shapes': [
'IconArrowLeft',
'IconArrowRight',
'IconArrowCircleLeft',
'IconArrowCircleRight',
'IconArrowRightDown',
'IconArrowUpRight',
'IconCollapse',
'IconExpand',
'IconCollapse45',
'IconExpand45',
'IconChevronDown',
'IconTriangleDown',
'IconTriangleDownFilled',
'IconTriangleUp',
'IconTriangleUpFilled',
'IconStar',
'IconStarFilled',
'IconHeart',
'IconHeartFilled',
],
Mathematics: [
'IconPlus',
'IconPlusSmall',
'IconPlusSquare',
'IconMinus',
'IconMinusSmall',
'IconMinusSquare',
'IconMultiply',
'IconPercentage',
'IconCalculator',
],
}

export const TEAMS_AND_COMPANIES = {
Analytics: [
'IconCorrelationAnalysis',
'IconGraph',
'IconLineGraph',
'IconRetention',
'IconFunnels',
'IconGanttChart',
'IconTrending',
'IconTrends',
'IconLifecycle',
'IconPieChart',
'IconUserPaths',
'IconStickiness',
'IconPageChart',
'IconSampling',
'IconLive',
'IconBadge',
],
Replay: [
'IconPlay',
'IconPlayFilled',
'IconPlaylist',
'IconPause',
'IconPauseFilled',
'IconRewind',
'IconRecord',
'IconRewindPlay',
'IconVideoCamera',
],
'Feature Success': ['IconFlask', 'IconTestTube', 'IconMultivariateTesting', 'IconSplitTesting'],
Pipeline: ['IconWebhooks', 'IconDecisionTree'],
'Product OS': ['IconNotebook', 'IconHogQL', 'IconDashboard', 'IconSupport'],
Logos: ['IconLogomark', 'IconGithub'],
}
17 changes: 17 additions & 0 deletions frontend/src/lib/lemon-ui/icons/icons.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as packageIcons from '@posthog/icons'

import { ELEMENTS, OBJECTS, TEAMS_AND_COMPANIES, TECHNOLOGY, UNUSED_ICONS } from './categories'

describe('icons', () => {
it('ensures all icons are categorised', async () => {
const validPackageIcons = Object.keys(packageIcons).filter((i) => !['BaseIcon', 'default'].includes(i))
const categories = { ...OBJECTS, ...TECHNOLOGY, ...ELEMENTS, ...TEAMS_AND_COMPANIES }
const categorisedIcons = Object.values(categories)
.map((category) => Object.values(category))
.flat(2)

const allIcons = [...categorisedIcons, ...UNUSED_ICONS]

expect(validPackageIcons.filter((i) => !allIcons.includes(i))).toEqual([])
})
})
92 changes: 92 additions & 0 deletions frontend/src/lib/lemon-ui/icons/icons3000.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import * as packageIcons from '@posthog/icons'
import { Meta, StoryObj } from '@storybook/react'
import { copyToClipboard } from 'lib/utils/copyToClipboard'

import { LemonCollapse } from '../LemonCollapse'
import { Tooltip } from '../Tooltip'
import { ELEMENTS, OBJECTS, TEAMS_AND_COMPANIES, TECHNOLOGY } from './categories'

const meta: Meta = {
title: 'PostHog 3000/Icons',
tags: ['test-skip'],
parameters: {
previewTabs: {
'storybook/docs/panel': {
hidden: true,
},
},
},
}
export default meta

const posthogIcons = Object.entries(packageIcons)
.filter(([key]) => key !== 'BaseIcon')
.map(([key, Icon]) => ({ name: key, icon: Icon }))

const IconTemplate = ({ icons }: { icons: { name: string; icon: any }[] }): JSX.Element => {
const onClick = (name: string): void => {
void copyToClipboard(name)
}

return (
<div className="grid grid-cols-6 gap-4">
{icons.map(({ name, icon: Icon }) => {
return (
<div onClick={() => onClick(name)} key={name} className="flex justify-center">
<Tooltip title="Click to copy">
<div className="flex flex-col items-center space-y-2 max-w-24 py-2 px-4 cursor-pointer rounded hover:bg-secondary-3000">
<Icon className="w-10 h-10" />
<span className="text-xs">{name}</span>
</div>
</Tooltip>
</div>
)
})}
</div>
)
}

export function Alphabetical(): JSX.Element {
return <IconTemplate icons={posthogIcons} />
}

const GroupBase = ({ group }: { group: Record<string, string[]> }): JSX.Element => {
return (
<LemonCollapse
multiple
panels={Object.entries(group).map(([key, icons]) => {
return {
key,
header: key,
content: (
<IconTemplate
icons={icons.map((icon) => {
return { name: icon, icon: packageIcons[icon] }
})}
/>
),
}
})}
/>
)
}

export const Elements: StoryObj = (): JSX.Element => {
return <GroupBase group={ELEMENTS} />
}
Elements.storyName = 'Category - Elements'

export const TeamsAndCompanies: StoryObj = (): JSX.Element => {
return <GroupBase group={TEAMS_AND_COMPANIES} />
}
TeamsAndCompanies.storyName = 'Category - Teams & Companies'

export const Technology: StoryObj = (): JSX.Element => {
return <GroupBase group={TECHNOLOGY} />
}
Technology.storyName = 'Category - Technology'

export const Objects: StoryObj = (): JSX.Element => {
return <GroupBase group={OBJECTS} />
}
Objects.storyName = 'Category - Objects'
4 changes: 2 additions & 2 deletions frontend/src/toolbar/bar/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IconLogomark,
IconNight,
IconQuestion,
IconTarget,
IconSearch,
IconToggle,
IconX,
} from '@posthog/icons'
Expand Down Expand Up @@ -185,7 +185,7 @@ export function Toolbar(): JSX.Element {
/>
{isAuthenticated ? (
<>
<ToolbarButton icon={<IconTarget />} menuId="inspect" />
<ToolbarButton icon={<IconSearch />} menuId="inspect" />
<ToolbarButton icon={<IconCursorClick />} menuId="heatmap" />
<ToolbarButton icon={<IconBolt />} menuId="actions" />
<ToolbarButton icon={<IconToggle />} menuId="flags" title="Feature flags" />
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@medv/finder": "^3.1.0",
"@microlink/react-json-view": "^1.21.3",
"@monaco-editor/react": "4.4.6",
"@posthog/icons": "0.6.3",
"@posthog/icons": "0.6.7",
"@posthog/plugin-scaffold": "^1.4.4",
"@react-hook/size": "^2.1.2",
"@rrweb/types": "2.0.0-alpha.11",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

4 changes: 4 additions & 0 deletions posthog/api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response:
"""
response = super().create(request, *args, **kwargs)
response.status_code = getattr(self, "SUCCESS_STATUS_CODE", status.HTTP_200_OK)

if response.status_code == status.HTTP_204_NO_CONTENT:
response.data = None

return response


Expand Down
1 change: 1 addition & 0 deletions posthog/api/test/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def test_anonymous_user_can_request_password_reset(self, mock_capture):
response = self.client.post("/api/reset/", {"email": self.CONFIG_EMAIL})
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertEqual(response.content.decode(), "")
self.assertEqual(response.headers["Content-Length"], "0")

user: User = User.objects.get(email=self.CONFIG_EMAIL)
self.assertEqual(
Expand Down

0 comments on commit df4be72

Please sign in to comment.