Commit 5495beb5 by Ivan

fix: fix layout

parent fff3f6c5
......@@ -3,7 +3,7 @@ import Layout from './Layout'
export default function Home({ auth, featured_images = [] }) {
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="Welcome" />
<div className="relative bg-white overflow-hidden">
......@@ -32,7 +32,7 @@ export default function Home({ auth, featured_images = [] }) {
Organize with tags, search with ease, and collaborate with others.
</p>
<div className="mt-5 sm:mt-8 sm:flex sm:justify-center lg:justify-start">
{auth.user ? (
{auth ? (
<div className="rounded-md shadow">
<Link
href="/images"
......@@ -222,7 +222,7 @@ export default function Home({ auth, featured_images = [] }) {
<span className="block text-indigo-600">Create your account today.</span>
</h2>
<div className="mt-8 flex lg:mt-0 lg:flex-shrink-0">
{auth.user ? (
{auth ? (
<div className="inline-flex rounded-md shadow">
<Link
href="/images/new"
......
......@@ -33,7 +33,7 @@ export default function Layout({ children, user, title }) {
)}
{user?.roles.includes('admin') && (
<Link
href="/admin"
href="/admin/images"
className="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium"
>
管理员
......@@ -156,7 +156,7 @@ export default function Layout({ children, user, title }) {
)}
{user?.roles?.includes('admin') && (
<Link
href="/admin"
href="/admin/images"
className="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium"
>
管理员
......
......@@ -4,7 +4,7 @@ import { Link } from '@inertiajs/react'
export default function AdminDashboard({ stats, auth }) {
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="Admin Dashboard" />
<div className="bg-white shadow overflow-hidden sm:rounded-lg">
<div className="px-4 py-5 sm:px-6">
......
......@@ -4,7 +4,7 @@ import ComImageIndex from '../../../components/images/ComImageIndex'
export default function AdminImagesIndex({ auth, images, pagination, filters }) {
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="图片管理" />
<ComImageIndex
auth={auth}
......
......@@ -4,7 +4,7 @@ import ComTagsIndex from '../../../components/tags/ComTagsIndex'
export default function AdminTagsIndex({ tags, auth, errors = {} }) {
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="标签管理" />
<ComTagsIndex
title="标签管理"
......
......@@ -4,7 +4,7 @@ import ComImageIndex from '../../../../components/images/ComImageIndex'
export default function TagsImagesIndex({ auth, tag, images, pagination, filters }) {
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title={`${tag.name} - 标签图片`} />
<ComImageIndex
auth={auth}
......
......@@ -31,7 +31,7 @@ export default function New({ auth, tag, errors = {} }) {
}
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title={`添加图片到标签: ${tag.name}`} />
<div className="bg-white shadow overflow-hidden sm:rounded-lg">
<div className="px-4 py-5 sm:px-6">
......
......@@ -60,7 +60,7 @@ export default function AdminUsersIndex({ users, auth, errors = {} }) {
}
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="Admin - Manage Users" />
<div className="bg-white shadow overflow-hidden sm:rounded-lg">
<div className="px-4 py-5 sm:px-6 flex justify-between items-center">
......@@ -160,7 +160,7 @@ export default function AdminUsersIndex({ users, auth, errors = {} }) {
>
Edit
</button>
{user.id !== auth.user.id && (
{user.id !== auth.id && (
<Link
href={`/admin/users/${user.id}`}
method="delete"
......
......@@ -4,7 +4,7 @@ import ComImageEdit from '../../components/images/ComImageEdit'
export default function Edit({ image, tags, auth, errors = {} }) {
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title={`Edit ${image.title}`} />
<ComImageEdit
image={image}
......
......@@ -32,7 +32,7 @@ export default function New({ auth, errors = {} }) {
}
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="上传新图片" />
<div className="bg-white shadow overflow-hidden sm:rounded-lg">
<div className="px-4 py-5 sm:px-6">
......
......@@ -37,7 +37,7 @@ export default function Search({ images, filters, tags, auth }) {
}
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="Search Images" />
<div className="bg-white shadow overflow-hidden sm:rounded-lg">
<div className="px-4 py-5 sm:px-6">
......
......@@ -6,8 +6,8 @@ import * as Tabs from '@radix-ui/react-tabs'
export default function ProfileShow({ auth, user_stats, errors = {} }) {
const { data, setData, patch, processing, reset } = useForm({
name: auth.user.name || '',
email_address: auth.user.email_address || '',
name: auth.name || '',
email_address: auth.email_address || '',
current_password: '',
password: '',
password_confirmation: '',
......@@ -23,7 +23,7 @@ export default function ProfileShow({ auth, user_stats, errors = {} }) {
}
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="My Profile" />
<Tabs.Root defaultValue="profile" className="bg-white shadow overflow-hidden sm:rounded-lg">
......@@ -182,7 +182,7 @@ export default function ProfileShow({ auth, user_stats, errors = {} }) {
<div className="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt className="text-sm font-medium text-gray-500">Account created</dt>
<dd className="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{new Date(auth.user.created_at).toLocaleDateString()}
{new Date(auth.created_at).toLocaleDateString()}
</dd>
</div>
<div className="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
......
......@@ -28,7 +28,7 @@ export default function SessionsIndex({ auth, sessions, flash }) {
}
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="Active Sessions" />
<div className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
......
......@@ -20,7 +20,7 @@ export default function SessionsSecurity({ auth, security_settings, flash }) {
}
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="Session Security" />
<div className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
......
......@@ -15,7 +15,7 @@ export default function TagsEdit({ tag, auth, errors = {} }) {
}
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="Edit Tag" />
<div className="max-w-2xl mx-auto py-6 sm:px-6 lg:px-8">
<div className="bg-white shadow overflow-hidden sm:rounded-lg">
......
......@@ -4,7 +4,7 @@ import ComTagsIndex from '../../components/tags/ComTagsIndex'
export default function TagsIndex({ tags, auth }) {
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="Tags" />
<ComTagsIndex
title="Tags"
......
......@@ -15,7 +15,7 @@ export default function TagsNew({ auth, errors = {} }) {
}
return (
<Layout user={auth.user}>
<Layout user={auth}>
<Head title="Create New Tag" />
<div className="max-w-2xl mx-auto py-6 sm:px-6 lg:px-8">
<div className="bg-white shadow overflow-hidden sm:rounded-lg">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment