Skip to content

Commit

Permalink
fix dialog styling
Browse files Browse the repository at this point in the history
  • Loading branch information
RomneyDa committed Jan 21, 2025
1 parent efced32 commit 4215559
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 26 deletions.
2 changes: 1 addition & 1 deletion gui/src/components/OnboardingCard/OnboardingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function OnboardingCard({ isDialog }: OnboardingCardProps) {

return (
<StyledCard
className="xs:py-4 xs:px-4 relative px-2 py-3"
className="xs:py-4 xs:px-4 relative flex-1 px-2 py-3"
data-testid="onboarding-card"
>
<OnboardingCardTabs
Expand Down
8 changes: 0 additions & 8 deletions gui/src/components/OnboardingCard/hooks/useOnboardingCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ export function useOnboardingCard(): UseOnboardingCard {

async function open(tab: TabTitle) {
navigate("/");

// Used to clear the chat panel before showing onboarding card
dispatch(
saveCurrentSession({
openNewSession: true,
}),
);

dispatch(setOnboardingCard({ show: true, activeTab: tab }));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { TabTitle } from "../components/OnboardingCardTabs";
import { useOnboardingCard } from "../hooks";
import OnboardingLocalTab from "../tabs/OnboardingLocalTab";
import MainTab from "./tabs/main";
import { hasPassedFTL } from "../../../util/freeTrial";
import { useAppSelector } from "../../../redux/hooks";

const StyledCard = styled.div`
margin: auto;
Expand All @@ -36,18 +34,8 @@ export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) {
setLocalStorage("onboardingStatus", "Started");
}

const isPastFreeTrialLimit = hasPassedFTL();
const isShowingDialog = useAppSelector((store) => store.ui.showDialog);

const [currentTab, setCurrentTab] = useState<"main" | "local">("main");

// A version of this pops up in a dialog
// so that history doesn't disappear or jump
// If free trial limit is reached mid-chat
if (isPastFreeTrialLimit && isShowingDialog) {
return null;
}

return (
<StyledCard className="xs:py-4 xs:px-4 relative px-2 py-3">
{!isDialog && (
Expand Down
14 changes: 9 additions & 5 deletions gui/src/components/dialogs/FreeTrialOverDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ function FreeTrialOverDialog() {
}
}, [history]);

if (usePlatform) {
return <PlatformOnboardingCard isDialog />;
} else {
return <OnboardingCard isDialog />;
}
return (
<div className="flex-1">
{usePlatform ? (
<PlatformOnboardingCard isDialog />
) : (
<OnboardingCard isDialog />
)}
</div>
);
}

export default FreeTrialOverDialog;

0 comments on commit 4215559

Please sign in to comment.