Update
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user