remove loading state

This commit is contained in:
Clas Wen 2025-09-30 00:16:06 +08:00
parent a293f77c8c
commit 5a175875ae

View file

@ -1,5 +1,5 @@
import { useState, useEffect } from "react" import { useState, useEffect } from "react"
import { Button, Spinner, Card, CardBody, CardFooter } from "@heroui/react" import { Button, Card, CardBody, CardFooter } from "@heroui/react"
import { makeLogtoClient } from "../../utils/auth" import { makeLogtoClient } from "../../utils/auth"
import { saturdayClient } from "../../utils/client" import { saturdayClient } from "../../utils/client"
import RepairHistoryCard from "./RepairHistoryCard" import RepairHistoryCard from "./RepairHistoryCard"
@ -13,7 +13,6 @@ type PublicEvent = components["schemas"]["PublicEvent"]
export default function RepairLandingSection() { export default function RepairLandingSection() {
const [userInfo, setUserInfo] = useState<UserInfoResponse | null>(null) const [userInfo, setUserInfo] = useState<UserInfoResponse | null>(null)
const [loading, setLoading] = useState(true)
const [recentEvents, setRecentEvents] = useState<PublicEvent[]>([]) const [recentEvents, setRecentEvents] = useState<PublicEvent[]>([])
const [selectedEvent, setSelectedEvent] = useState<PublicEvent | null>(null) const [selectedEvent, setSelectedEvent] = useState<PublicEvent | null>(null)
const [isEditOpen, setIsEditOpen] = useState(false) const [isEditOpen, setIsEditOpen] = useState(false)
@ -36,9 +35,6 @@ export default function RepairLandingSection() {
catch (error) { catch (error) {
console.error("Error checking auth status:", error) console.error("Error checking auth status:", error)
} }
finally {
setLoading(false)
}
} }
const fetchRecentEvents = async () => { const fetchRecentEvents = async () => {
@ -118,16 +114,6 @@ export default function RepairLandingSection() {
window.location.href = "/repair/history" window.location.href = "/repair/history"
} }
if (loading) {
return (
<div className="container mx-auto pt-16 pb-20">
<div className="flex flex-col items-center justify-center">
<Spinner size="lg" />
</div>
</div>
)
}
return ( return (
<div className="container mx-auto pt-16 pb-20"> <div className="container mx-auto pt-16 pb-20">
{/* Main service section - always shown */} {/* Main service section - always shown */}
@ -199,22 +185,6 @@ export default function RepairLandingSection() {
</div> </div>
)} )}
{/* Login suggestion for unauthenticated users */}
{/* {!userInfo && (
<div className="mt-16 flex justify-center">
<Alert
className="items-center max-w-md"
endContent={(
<Button color="primary" size="sm" variant="flat" onPress={handleLogin}>
</Button>
)}
>
</Alert>
</div>
)} */}
{/* Edit Modal */} {/* Edit Modal */}
{selectedEvent && ( {selectedEvent && (
<EditRepairModal <EditRepairModal