Commit a152fff4 by Ivan

fix: fix images

parent 5c787d05
...@@ -124,6 +124,7 @@ export default function ImageUploadForm({ ...@@ -124,6 +124,7 @@ export default function ImageUploadForm({
id="file-upload" id="file-upload"
name="file" name="file"
type="file" type="file"
accept="image/*"
className="sr-only" className="sr-only"
onChange={handleFileChange} onChange={handleFileChange}
/> />
......
...@@ -5,7 +5,8 @@ import { forwardRef } from 'react'; ...@@ -5,7 +5,8 @@ import { forwardRef } from 'react';
// Convert to forwardRef to allow the IntersectionObserver to work // Convert to forwardRef to allow the IntersectionObserver to work
export const ComImageCard = forwardRef(({ image, path, showUserName = false}, ref) => { export const ComImageCard = forwardRef(({ image, path, showUserName = false}, ref) => {
return ( return (
<div <Link
href={`${path}/${image.id}`}
ref={ref} ref={ref}
className="bg-white overflow-hidden shadow rounded-lg flex flex-col" className="bg-white overflow-hidden shadow rounded-lg flex flex-col"
> >
...@@ -51,6 +52,6 @@ export const ComImageCard = forwardRef(({ image, path, showUserName = false}, re ...@@ -51,6 +52,6 @@ export const ComImageCard = forwardRef(({ image, path, showUserName = false}, re
</span> </span>
</div> </div>
</div> </div>
</div> </Link>
); );
}); });
\ No newline at end of file
...@@ -359,7 +359,7 @@ export default function ComTagsIndex({ ...@@ -359,7 +359,7 @@ export default function ComTagsIndex({
<button <button
type="submit" type="submit"
disabled={editProcessing} disabled={editProcessing}
className="inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:text-sm disabled:opacity-50" className="inline-flex mb-2 justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:text-sm disabled:opacity-50"
> >
更新 更新
</button> </button>
......
...@@ -71,7 +71,7 @@ export default function Layout({ children, user, title }) { ...@@ -71,7 +71,7 @@ export default function Layout({ children, user, title }) {
</DropdownMenu.Trigger> </DropdownMenu.Trigger>
<DropdownMenu.Portal> <DropdownMenu.Portal>
<DropdownMenu.Content <DropdownMenu.Content
className="min-w-[220px] bg-white rounded-md p-1 shadow-lg" className="min-w-[220px] bg-white rounded-md p-1 shadow-lg z-50"
sideOffset={5} sideOffset={5}
> >
<DropdownMenu.Item className="text-sm text-gray-700 px-4 py-2 rounded hover:bg-gray-100"> <DropdownMenu.Item className="text-sm text-gray-700 px-4 py-2 rounded hover:bg-gray-100">
......
import { Head, useForm } from '@inertiajs/react' import { Head, useForm, router } from '@inertiajs/react'
import Layout from '../../Layout' import Layout from '../../Layout'
import ImageUploadForm from '../../../components/ImageUploadForm' import ImageUploadForm from '../../../components/ImageUploadForm'
...@@ -8,7 +8,7 @@ export default function AdminImagesEdit({ image, tags, auth }) { ...@@ -8,7 +8,7 @@ export default function AdminImagesEdit({ image, tags, auth }) {
? image.tags.map(tag => tag.id) ? image.tags.map(tag => tag.id)
: [] : []
const { data, setData, patch, processing, errors } = useForm({ const { data, setData, processing, errors } = useForm({
title: image.title || '', title: image.title || '',
status: image.status, status: image.status,
tag_ids: initialTagIds, tag_ids: initialTagIds,
...@@ -16,7 +16,7 @@ export default function AdminImagesEdit({ image, tags, auth }) { ...@@ -16,7 +16,7 @@ export default function AdminImagesEdit({ image, tags, auth }) {
const handleSubmit = (e) => { const handleSubmit = (e) => {
e.preventDefault() e.preventDefault()
patch(`/admin/images/${image.id}`) router.patch(`/admin/images/${image.id}`, { image: data })
} }
return ( return (
......
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