mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-09-09 16:53:33 +02:00
Make roadmap ai chat header responsive
This commit is contained in:
@@ -50,7 +50,8 @@ import { slugify } from '../../lib/slugger';
|
|||||||
import { AIChatActionButtons } from './AIChatActionButtons';
|
import { AIChatActionButtons } from './AIChatActionButtons';
|
||||||
import { cn } from '../../lib/classname';
|
import { cn } from '../../lib/classname';
|
||||||
import {
|
import {
|
||||||
getTailwindScreenDimension, type TailwindScreenDimensions
|
getTailwindScreenDimension,
|
||||||
|
type TailwindScreenDimensions,
|
||||||
} from '../../lib/is-mobile';
|
} from '../../lib/is-mobile';
|
||||||
|
|
||||||
export type RoamdapAIChatHistoryType = {
|
export type RoamdapAIChatHistoryType = {
|
||||||
@@ -465,6 +466,10 @@ export function RoadmapAIChat(props: RoadmapAIChatProps) {
|
|||||||
setSelectedTopicTitle(null);
|
setSelectedTopicTitle(null);
|
||||||
setActiveTab('chat');
|
setActiveTab('chat');
|
||||||
}}
|
}}
|
||||||
|
onCloseChat={() => {
|
||||||
|
setIsChatMobileVisible(false);
|
||||||
|
setActiveTab('chat');
|
||||||
|
}}
|
||||||
selectedTopicId={selectedTopicId}
|
selectedTopicId={selectedTopicId}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@@ -4,9 +4,7 @@ import { queryClient } from '../../stores/query-client';
|
|||||||
import { billingDetailsOptions } from '../../queries/billing';
|
import { billingDetailsOptions } from '../../queries/billing';
|
||||||
import { isLoggedIn } from '../../lib/jwt';
|
import { isLoggedIn } from '../../lib/jwt';
|
||||||
import { BookIcon, BotIcon, GiftIcon, XIcon } from 'lucide-react';
|
import { BookIcon, BotIcon, GiftIcon, XIcon } from 'lucide-react';
|
||||||
import type {
|
import type { RoadmapAIChatTab } from './RoadmapAIChat';
|
||||||
RoadmapAIChatTab
|
|
||||||
} from './RoadmapAIChat';
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useToast } from '../../hooks/use-toast';
|
import { useToast } from '../../hooks/use-toast';
|
||||||
import { getPercentage } from '../../lib/number';
|
import { getPercentage } from '../../lib/number';
|
||||||
@@ -19,6 +17,8 @@ type RoadmapAIChatHeaderProps = {
|
|||||||
onLogin: () => void;
|
onLogin: () => void;
|
||||||
onUpgrade: () => void;
|
onUpgrade: () => void;
|
||||||
|
|
||||||
|
onCloseChat: () => void;
|
||||||
|
|
||||||
activeTab: RoadmapAIChatTab;
|
activeTab: RoadmapAIChatTab;
|
||||||
onTabChange: (tab: RoadmapAIChatTab) => void;
|
onTabChange: (tab: RoadmapAIChatTab) => void;
|
||||||
onCloseTopic: () => void;
|
onCloseTopic: () => void;
|
||||||
@@ -40,14 +40,14 @@ function TabButton(props: TabButtonProps) {
|
|||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className={cn(
|
className={cn(
|
||||||
'flex flex-shrink-0 h-full items-center gap-2 px-4 text-sm',
|
'flex h-full flex-shrink-0 items-center gap-2 px-4 text-sm',
|
||||||
isActive && 'bg-gray-100',
|
isActive && 'bg-gray-100',
|
||||||
onClose && 'pr-2 pl-4',
|
onClose && 'pr-2 pl-4',
|
||||||
)}
|
)}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{icon}
|
{icon}
|
||||||
<span>{label}</span>
|
<span className="hidden sm:block">{label}</span>
|
||||||
|
|
||||||
{onClose && (
|
{onClose && (
|
||||||
<span
|
<span
|
||||||
@@ -70,6 +70,7 @@ export function RoadmapAIChatHeader(props: RoadmapAIChatHeaderProps) {
|
|||||||
onLogin,
|
onLogin,
|
||||||
onUpgrade,
|
onUpgrade,
|
||||||
isLoading: isDataLoading,
|
isLoading: isDataLoading,
|
||||||
|
onCloseChat,
|
||||||
|
|
||||||
activeTab,
|
activeTab,
|
||||||
onTabChange,
|
onTabChange,
|
||||||
@@ -150,8 +151,8 @@ export function RoadmapAIChatHeader(props: RoadmapAIChatHeaderProps) {
|
|||||||
className="hidden rounded-md bg-gray-200 px-2 py-1 text-sm hover:bg-gray-300 2xl:block"
|
className="hidden rounded-md bg-gray-200 px-2 py-1 text-sm hover:bg-gray-300 2xl:block"
|
||||||
onClick={handleCreditsClick}
|
onClick={handleCreditsClick}
|
||||||
>
|
>
|
||||||
<span className="font-medium">{usagePercentage}%</span>{' '}
|
<span className="font-medium">{usagePercentage}%</span> limit
|
||||||
limit used
|
used
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="flex items-center gap-1 rounded-md bg-yellow-400 px-2 py-1 text-sm text-black hover:bg-yellow-500"
|
className="flex items-center gap-1 rounded-md bg-yellow-400 px-2 py-1 text-sm text-black hover:bg-yellow-500"
|
||||||
@@ -160,6 +161,12 @@ export function RoadmapAIChatHeader(props: RoadmapAIChatHeaderProps) {
|
|||||||
<GiftIcon className="size-4" />
|
<GiftIcon className="size-4" />
|
||||||
Upgrade
|
Upgrade
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
className="hidden items-center gap-1 rounded-md bg-gray-200 px-2 py-1 text-sm text-black hover:bg-gray-300 max-xl:flex"
|
||||||
|
onClick={onCloseChat}
|
||||||
|
>
|
||||||
|
<XIcon className="size-3.5" strokeWidth={2.5} />
|
||||||
|
</button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user