Reduce bundle size by importing single icons at a time (#6644)
* Removed barrel import for icons to reduce bundle size. * Fixed replacement mistakes * Reverted unneccesary yarn.lock updates * Added some missed Icon. import conversions * Remove merge artifact import in @calcom/ui * Don't import Icon in pages/[user] * Update packages/ui/package.json Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: Omar López <[email protected]>
This commit is contained in:
155 files changed
+881
-768
No files matched your search
@@ -15,18 +15,30 @@ import {
|
||||
Badge,
|
||||
Button,
|
||||
ErrorBoundary,
|
||||
Icon,
|
||||
VerticalTabItemProps,
|
||||
VerticalTabItem,
|
||||
Skeleton,
|
||||
useMeta,
|
||||
} from "@calcom/ui";
|
||||
import {
|
||||
FiUser,
|
||||
FiKey,
|
||||
FiCreditCard,
|
||||
FiTerminal,
|
||||
FiUsers,
|
||||
FiLock,
|
||||
FiArrowLeft,
|
||||
FiChevronDown,
|
||||
FiChevronRight,
|
||||
FiPlus,
|
||||
FiMenu,
|
||||
} from "@calcom/ui/components/icon";
|
||||
|
||||
const tabs: VerticalTabItemProps[] = [
|
||||
{
|
||||
name: "my_account",
|
||||
href: "/settings/my-account",
|
||||
icon: Icon.FiUser,
|
||||
icon: FiUser,
|
||||
children: [
|
||||
{ name: "profile", href: "/settings/my-account/profile" },
|
||||
{ name: "general", href: "/settings/my-account/general" },
|
||||
@@ -40,7 +52,7 @@ const tabs: VerticalTabItemProps[] = [
|
||||
{
|
||||
name: "security",
|
||||
href: "/settings/security",
|
||||
icon: Icon.FiKey,
|
||||
icon: FiKey,
|
||||
children: [
|
||||
{ name: "password", href: "/settings/security/password" },
|
||||
{ name: "2fa_auth", href: "/settings/security/two-factor-auth" },
|
||||
@@ -50,13 +62,13 @@ const tabs: VerticalTabItemProps[] = [
|
||||
{
|
||||
name: "billing",
|
||||
href: "/settings/billing",
|
||||
icon: Icon.FiCreditCard,
|
||||
icon: FiCreditCard,
|
||||
children: [{ name: "manage_billing", href: "/settings/billing" }],
|
||||
},
|
||||
{
|
||||
name: "developer",
|
||||
href: "/settings/developer",
|
||||
icon: Icon.FiTerminal,
|
||||
icon: FiTerminal,
|
||||
children: [
|
||||
//
|
||||
{ name: "webhooks", href: "/settings/developer/webhooks" },
|
||||
@@ -68,13 +80,13 @@ const tabs: VerticalTabItemProps[] = [
|
||||
{
|
||||
name: "teams",
|
||||
href: "/settings/teams",
|
||||
icon: Icon.FiUsers,
|
||||
icon: FiUsers,
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
name: "admin",
|
||||
href: "/settings/admin",
|
||||
icon: Icon.FiLock,
|
||||
icon: FiLock,
|
||||
children: [
|
||||
//
|
||||
{ name: "impersonation", href: "/settings/admin/impersonation" },
|
||||
@@ -121,7 +133,7 @@ const BackButtonInSidebar = ({ name }: { name: string }) => {
|
||||
href="/event-types"
|
||||
className="group my-6 flex h-6 max-h-6 w-64 flex-row items-center rounded-md py-2 px-3 text-sm font-medium leading-4 text-black hover:bg-gray-100 group-hover:text-gray-700 [&[aria-current='page']]:bg-gray-200 [&[aria-current='page']]:text-gray-900"
|
||||
data-testid={`vertical-tab-${name}`}>
|
||||
<Icon.FiArrowLeft className="h-4 w-4 stroke-[2px] ltr:mr-[10px] rtl:ml-[10px] md:mt-0" />
|
||||
<FiArrowLeft className="h-4 w-4 stroke-[2px] ltr:mr-[10px] rtl:ml-[10px] md:mt-0" />
|
||||
<Skeleton title={name} as="p" className="max-w-36 min-h-4 truncate">
|
||||
{name}
|
||||
</Skeleton>
|
||||
@@ -247,11 +259,7 @@ const SettingsSidebarContainer = ({
|
||||
])
|
||||
}>
|
||||
<div className="ltr:mr-3 rtl:ml-3">
|
||||
{teamMenuState[index].teamMenuOpen ? (
|
||||
<Icon.FiChevronDown />
|
||||
) : (
|
||||
<Icon.FiChevronRight />
|
||||
)}
|
||||
{teamMenuState[index].teamMenuOpen ? <FiChevronDown /> : <FiChevronRight />}
|
||||
</div>
|
||||
<img
|
||||
src={getPlaceholderAvatar(team.logo, team?.name as string)}
|
||||
@@ -320,7 +328,7 @@ const SettingsSidebarContainer = ({
|
||||
name={t("add_a_team")}
|
||||
href={`${WEBAPP_URL}/settings/teams/new`}
|
||||
textClassNames="px-3 text-gray-900 font-medium text-sm"
|
||||
icon={Icon.FiPlus}
|
||||
icon={FiPlus}
|
||||
disableChevron
|
||||
/>
|
||||
</div>
|
||||
@@ -339,14 +347,14 @@ const MobileSettingsContainer = (props: { onSideContainerOpen?: () => void }) =>
|
||||
<>
|
||||
<nav className="sticky top-0 z-20 flex w-full items-center justify-between border-b border-gray-100 bg-gray-50 p-4 sm:relative lg:hidden">
|
||||
<div className="flex items-center space-x-3 ">
|
||||
<Button StartIcon={Icon.FiMenu} color="minimal" variant="icon" onClick={props.onSideContainerOpen}>
|
||||
<Button StartIcon={FiMenu} color="minimal" variant="icon" onClick={props.onSideContainerOpen}>
|
||||
<span className="sr-only">{t("show_navigation")}</span>
|
||||
</Button>
|
||||
|
||||
<a
|
||||
href="/"
|
||||
className="flex items-center space-x-2 rounded-md px-3 py-1 hover:bg-gray-200 rtl:space-x-reverse">
|
||||
<Icon.FiArrowLeft className="text-gray-700" />
|
||||
<FiArrowLeft className="text-gray-700" />
|
||||
<p className="font-semibold text-black">{t("settings")}</p>
|
||||
</a>
|
||||
</div>
|
||||
@@ -426,7 +434,7 @@ function ShellHeader() {
|
||||
<div className="mb-8 flex w-full items-center border-b border-gray-200 pb-6">
|
||||
{meta.backButton && (
|
||||
<a href="javascript:history.back()">
|
||||
<Icon.FiArrowLeft className="mr-7" />
|
||||
<FiArrowLeft className="mr-7" />
|
||||
</a>
|
||||
)}
|
||||
<div>
|
||||
|
||||
Reference in new issue
Block a user