Skip to content

Commit

Permalink
minor UI updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chitalian committed Sep 18, 2024
1 parent 87602f3 commit c88f085
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 22 deletions.
2 changes: 1 addition & 1 deletion valhalla/jawn/src/managers/stripe/StripeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const proProductPrices = {
alerts: process.env.PRICE_PROD_ALERTS_ID!,
};

const EARLY_ADOPTER_COUPON = "0IPsIob0";
const EARLY_ADOPTER_COUPON = "9ca5IeEs";

export class StripeManager extends BaseManager {
private stripe: Stripe;
Expand Down
41 changes: 35 additions & 6 deletions web/components/layout/auth/DesktopSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,33 @@ const DesktopSidebar = ({ NAVIGATION }: SidebarProps) => {
[isCollapsed]
);

const NAVIGATION_ITEMS = useMemo(() => {
if (isCollapsed) {
return NAVIGATION.flatMap((item) => {
if (item.subItems && expandedItems.includes(item.name)) {
return [
item,
...item.subItems.filter((subItem) => subItem.icon !== null),
];
}
return [item];
}).filter((item) => item.icon !== null);
}

return NAVIGATION.map((item) => {
if (item.subItems) {
return {
...item,
subItems: item.subItems.map((subItem) => ({
...subItem,
href: subItem.href,
})),
};
}
return item;
});
}, [NAVIGATION, isCollapsed, expandedItems]);

return (
<>
<div
Expand All @@ -82,8 +109,10 @@ const DesktopSidebar = ({ NAVIGATION }: SidebarProps) => {
>
<div className="w-full flex flex-grow flex-col overflow-y-auto border-r dark:border-gray-700 justify-between">
<div className="flex items-center gap-2 h-14 border-b dark:border-gray-700">
{!isCollapsed && <OrgDropdown />}
<div className={cn("mx-auto", !isCollapsed && "mr-2")}>
<div className="flex items-center gap-2 w-fill">
{!isCollapsed && <OrgDropdown />}
</div>
<div className={cn("mx-auto", isCollapsed ? "w-fit" : "mr-2")}>
<Button
variant="ghost"
size="icon"
Expand Down Expand Up @@ -128,7 +157,7 @@ const DesktopSidebar = ({ NAVIGATION }: SidebarProps) => {
className="group flex flex-col gap-4 py-2 data-[collapsed=true]:py-2 "
>
<nav className="grid gap-1 px-2 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2">
{NAVIGATION.map((link) => (
{NAVIGATION_ITEMS.map((link) => (
<NavItem
key={link.name}
link={link}
Expand All @@ -145,11 +174,11 @@ const DesktopSidebar = ({ NAVIGATION }: SidebarProps) => {
<InfoBox icon={() => <></>} className="flex flex-col">
<div>
<span className="text-[#1c4ed8] text-xs font-semibold font-['Inter'] leading-tight">
Early Adopter Exclusive: $300 Credit for the year. <br />
Early Adopter Exclusive: $120 Credit for the year. <br />
</span>
<span className="text-[#1c4ed8] text-xs font-light font-['Inter'] leading-tight">
Switch to Pro and get $25/mo credit on requests exceeding
100k, as a thank you for your early support!{" "}
Switch to Pro and get $10/mo credit for 1 year, as a thank
you for your early support!
</span>
</div>
<Button className="bg-blue-700 mt-[10px] text-xs" size="xs">
Expand Down
31 changes: 16 additions & 15 deletions web/components/layout/orgDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,22 @@ export default function OrgDropdown({}: OrgDropdownProps) {
<>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="justify-between ml-2 w-full">
<div className="flex items-center w-full">
{currentIcon && (
<currentIcon.icon
className={clsx(
`text-${currentColor?.name}-500`,
"mr-3 flex-shrink-0 h-4 w-4"
)}
aria-hidden="true"
/>
)}
<p className="text-sm font-semibold truncate w-fit max-w-[7.25rem] text-left">
{orgContext?.currentOrg?.name}
</p>
</div>
<Button
variant="ghost"
className="flex items-center justify-between w-full ml-1 p-2"
>
{currentIcon && (
<currentIcon.icon
className={clsx(
`text-${currentColor?.name}-500`,
"mr-2 flex-shrink-0 h-4 w-4"
)}
aria-hidden="true"
/>
)}
<p className="text-xs font-semibold truncate w-fit text-left">
{orgContext?.currentOrg?.name}
</p>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-[15rem] ml-2 mt-1 max-h-[90vh] flex flex-col">
Expand Down

0 comments on commit c88f085

Please sign in to comment.