Update
This commit is contained in:
@@ -18,7 +18,8 @@ const AuthDialog = ({}) => {
|
||||
// Listen for text element selection (but don't auto-open sidebar)
|
||||
useEffect(() => {
|
||||
const handleOpenAuth = () => {
|
||||
setIsOpen(true);
|
||||
// Disabled for MVP - don't auto-open auth dialog
|
||||
// setIsOpen(true);
|
||||
};
|
||||
|
||||
const handleOpenLogin = () => {
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
import useUserStore from '@/stores/UserStore';
|
||||
import { usePage } from '@inertiajs/react';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
const AuthUser = () => {
|
||||
const { auth } = usePage().props;
|
||||
const { user, fetchUser } = useUserStore();
|
||||
|
||||
useEffect(() => {
|
||||
if (auth.user) {
|
||||
if (user == null) {
|
||||
fetchUser();
|
||||
}
|
||||
// Always try to fetch user data on component mount
|
||||
if (user === null) {
|
||||
fetchUser();
|
||||
}
|
||||
}, [auth.user]);
|
||||
}, [user, fetchUser]);
|
||||
};
|
||||
|
||||
export default AuthUser;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { usePage } from '@inertiajs/react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet';
|
||||
import { useMitt } from '@/plugins/MittContext';
|
||||
import useLocalSettingsStore from '@/stores/localSettingsStore';
|
||||
import useUserStore from '@/stores/UserStore';
|
||||
import { Link } from '@inertiajs/react';
|
||||
|
||||
export default function EditNavSidebar({ isOpen, onClose }) {
|
||||
const { auth } = usePage().props;
|
||||
const { user } = useUserStore();
|
||||
|
||||
const emitter = useMitt();
|
||||
|
||||
@@ -32,7 +31,7 @@ export default function EditNavSidebar({ isOpen, onClose }) {
|
||||
|
||||
<div className="space-y-3">
|
||||
<div className="grid px-2">
|
||||
{!auth.user && (
|
||||
{!user && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
openAuth(false);
|
||||
@@ -42,7 +41,7 @@ export default function EditNavSidebar({ isOpen, onClose }) {
|
||||
Sign Up
|
||||
</Button>
|
||||
)}
|
||||
{!auth.user && (
|
||||
{!user && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
openAuth(true);
|
||||
@@ -58,7 +57,7 @@ export default function EditNavSidebar({ isOpen, onClose }) {
|
||||
<Link className="text-primary block w-full text-sm underline-offset-4 hover:underline" href={route('home')} as="button">
|
||||
Home
|
||||
</Link>
|
||||
{auth.user && (
|
||||
{user && (
|
||||
<Link
|
||||
className="text-primary block w-full text-sm underline-offset-4 hover:underline"
|
||||
method="post"
|
||||
|
||||
@@ -28,8 +28,7 @@ const EditorAISheet = () => {
|
||||
const pollingIntervalRef = useRef(null);
|
||||
const currentJobIdRef = useRef(null);
|
||||
|
||||
const { credits } = useUserStore();
|
||||
const { auth } = usePage().props;
|
||||
const { credits, user } = useUserStore();
|
||||
|
||||
useEffect(() => {
|
||||
const openSheetListener = () => {
|
||||
@@ -46,10 +45,10 @@ const EditorAISheet = () => {
|
||||
|
||||
// Check for active job on component mount
|
||||
useEffect(() => {
|
||||
if (auth.user) {
|
||||
if (user) {
|
||||
checkForActiveJob();
|
||||
}
|
||||
}, [auth.user]);
|
||||
}, [user]);
|
||||
|
||||
const checkForActiveJob = async () => {
|
||||
try {
|
||||
@@ -218,7 +217,7 @@ const EditorAISheet = () => {
|
||||
</div>
|
||||
)}
|
||||
<div className={cn('space-y-2', !prompt.trim() && 'invisible')}>
|
||||
{auth.user ? (
|
||||
{user ? (
|
||||
<>
|
||||
<Button
|
||||
onClick={handleSend}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// resources/js/Pages/User/Partials/upgrade-sheet.jsx
|
||||
import { usePage } from '@inertiajs/react';
|
||||
|
||||
import { SparklesText } from '@/components/magicui/sparkles-text';
|
||||
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion';
|
||||
@@ -17,8 +16,7 @@ import UpgradePlanCarousel from './partials/upgrade-plan-carousel.tsx';
|
||||
|
||||
const UpgradeSheet = () => {
|
||||
const { subscription, one_times, isFetchingPricing, fetchPricing, isCheckingOut, checkoutSubscribe, checkoutPurchase } = usePricingStore();
|
||||
const { plan, billing, user_usage, credits, redirectBillingPortal, isRedirectingToBilling } = useUserStore();
|
||||
const { auth } = usePage().props;
|
||||
const { plan, billing, user_usage, credits, redirectBillingPortal, isRedirectingToBilling, user } = useUserStore();
|
||||
|
||||
// State to control sheet visibility
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
@@ -118,7 +116,7 @@ const UpgradeSheet = () => {
|
||||
</SheetHeader>
|
||||
|
||||
<div className="mx-auto w-full max-w-[600px] space-y-3 px-4">
|
||||
{auth?.user ? (
|
||||
{user ? (
|
||||
<div id="stats">
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
{/* Non-watermark Exports */}
|
||||
@@ -163,7 +161,7 @@ const UpgradeSheet = () => {
|
||||
|
||||
{subscription ? (
|
||||
<>
|
||||
{auth.user && plan.tier != 'free' ? (
|
||||
{user && plan.tier != 'free' ? (
|
||||
<div className="mx-auto space-y-6 rounded-lg border p-4 text-center sm:p-7">
|
||||
<SparklesText className="text-xl font-bold sm:text-xl">You're now in the {plan?.name} plan!</SparklesText>
|
||||
</div>
|
||||
@@ -268,7 +266,7 @@ const UpgradeSheet = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!(auth.user && plan.tier != 'free') && (
|
||||
{!(user && plan.tier != 'free') && (
|
||||
<div id="faq" className="space-y-4 rounded-lg border p-4 sm:p-7">
|
||||
<div className="text-center text-xl font-extrabold sm:text-2xl">Frequently Asked Questions</div>
|
||||
<Accordion type="single" collapsible className="w-full" defaultValue="item-1">
|
||||
|
||||
Reference in New Issue
Block a user