From 3a1d4cc40a5e93471de930f6ccf31f0db35ac3cb Mon Sep 17 00:00:00 2001 From: User Date: Sun, 29 Dec 2024 14:40:56 -0500 Subject: [PATCH] Fixed images on rtl mode --- app/Http/Controllers/ComicController.php | 18 ++++++++++--- bun.lockb | Bin 169274 -> 169274 bytes composer.lock | 10 +++---- resources/js/Layouts/GuestLayout.jsx | 2 -- resources/js/Pages/Auth/Login.jsx | 28 +++++++++---------- resources/js/Pages/Comic/Chapters.jsx | 30 +++++++++++++++++---- resources/js/Pages/Comic/Histories.jsx | 2 +- resources/js/Pages/Comic/Index.jsx | 2 +- resources/js/Pages/Comic/Read.jsx | 10 +++---- resources/js/components/ui/app-sidebar.jsx | 19 +++++++++++-- resources/views/app.blade.php | 2 +- 11 files changed, 82 insertions(+), 41 deletions(-) diff --git a/app/Http/Controllers/ComicController.php b/app/Http/Controllers/ComicController.php index 625af43..22ff3e8 100644 --- a/app/Http/Controllers/ComicController.php +++ b/app/Http/Controllers/ComicController.php @@ -8,6 +8,8 @@ use App\Models\Comic; use App\Models\Image; use App\Remote\CopyManga; use App\Remote\ImageFetcher; +use Exception; +use GuzzleHttp\Exception\GuzzleException; use Illuminate\Contracts\Routing\ResponseFactory; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Foundation\Application; @@ -118,6 +120,13 @@ class ComicController extends Controller } } + /** + * + * + * @param Request $request + * @return Response + * @throws GuzzleException + */ public function index(Request $request): Response { $params = []; @@ -152,7 +161,7 @@ class ComicController extends Controller { $comics = $this->copyManga->search($search, 30, $request->header('offset', 0)); - // Seacrh API is limited, no upsert + // Search API is limited, no upsert return Inertia::render('Comic/Index', [ 'comics' => $comics, @@ -163,7 +172,7 @@ class ComicController extends Controller public function chapters(Request $request, string $pathword = ''): Response { $comic = $this->copyManga->comic($pathword); - $chapters = $this->copyManga->chapters($pathword, 200, 0, [], $request->get('group', 'default')); + $chapters = $this->copyManga->chapters($pathword, 200, $request->header('offset', 0), [], $request->get('group', 'default')); // Get the comic object and fill other parameters try { @@ -221,7 +230,8 @@ class ComicController extends Controller return Inertia::render('Comic/Chapters', [ 'comic' => $comic, 'chapters' => $chapters, - 'histories' => $histories + 'histories' => $histories, + 'offset' => $request->header('offset', 0) ]); } @@ -276,7 +286,7 @@ class ComicController extends Controller { // Get history $histories = $request->user()->readingHistories()->with(['comic:id,name,pathword'])->orderByDesc('reading_histories.created_at') - ->select(['reading_histories.id as hid', 'reading_histories.created_at', 'chapters.comic_id', 'chapters.name'])->paginate(50)->toArray(); + ->select(['reading_histories.id as hid', 'reading_histories.created_at as read_at', 'chapters.comic_id', 'chapters.name'])->paginate(50)->toArray(); return Inertia::render('Comic/Histories', [ 'histories' => $histories diff --git a/bun.lockb b/bun.lockb index 574592b1bf5fb146af81b281f2f06f8e4610683b..8b969d6122a10a14fdf117dbeead5ba62a80b924 100755 GIT binary patch delta 764 zcmXYvO-NKx7>4h6$IPy&nT0Z?qZ6qVE(#YxD3~Ud8a0(E^hX;j7-Rg&p!~zyxUx+j zM2?O#Zd^-(5V=YMY0*NES_m!LWK2PjoACMY9PR_}dCzy>bMAM~@{19a9!3^*?z z?8GTeJY^F* zh#lH`WxcWQwl?O0^~}D{dSX2&(Cwt0EkBAZhYE;5B~(Eaj_L4>MEpod56;TF;2!a} z;jXW5W~9$w^7PBBoY1b6JdkaDpOSuQ)VeuY^`}Jrl$;BHB&Cd#h2aQHz(Y=06Vg~( z?pF`7egQ7RC1`_oupiV6EpXn`|8vr+YiTLde`%?WUBivR6=;QZ*nk13V29J}P!F$} zXCMK6VE^nUSmUq4SNH}I(K{K527~Axs1%*dNVs|hZP(1MP$@*ou7ba4yDnRB+0)M% Pd8C_fC1>f(y!hE2sV!%V delta 753 zcmXYvO-NKx6vyv*qf@;mt)>#Bd^$P=(=J>HqL7tjMbW1T`9Yg3m~u+3Akng1xUx-W z<;*xUZQQhp1XnFul*<-ETb2Wm+k*B@bBmJ9b`#b>jw!3!25siWxa+l$_$QNQHQ_C` z6IZ?Mq}LK?-_gwep4WB||3~f_u+QeaR?QPI68b(bhidH% zqUnNk_St^+gYDniW*t8OO(?1PS?uPxO<)WBaA~6-=syqlqJ)Bp8Nvz!eRW|;S=!& zMAV(*{TwQggF9e diff --git a/resources/js/Pages/Auth/Login.jsx b/resources/js/Pages/Auth/Login.jsx index f26823b..ab0b482 100644 --- a/resources/js/Pages/Auth/Login.jsx +++ b/resources/js/Pages/Auth/Login.jsx @@ -1,11 +1,12 @@ +import { Head, Link, useForm } from '@inertiajs/react'; +import GuestLayout from "@/Layouts/GuestLayout.jsx"; + import InputError from '@/components/InputError'; import Checkbox from '@/components/Checkbox'; import PrimaryButton from '@/components/PrimaryButton'; import TextInput from '@/components/TextInput'; -import { Head, Link, useForm } from '@inertiajs/react'; import { Label } from "@/components/ui/label" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card.jsx"; -import GuestLayout from "@/Layouts/GuestLayout.jsx"; import { Alert, AlertDescription } from "@/components/ui/alert.jsx"; export default function Login({ status, canResetPassword }) { @@ -45,7 +46,7 @@ export default function Login({ status, canResetPassword }) {
setData('email', e.target.value) } required /> + tabIndex="1" onChange={ (e) => setData('email', e.target.value) } required />
@@ -57,26 +58,23 @@ export default function Login({ status, canResetPassword }) {
setData('password', e.target.value) } />
- - setData('remember', e.target.checked) - } - /> + setData('remember', e.target.checked) } /> + className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"> + Remember me +
- Login + + Login +
Don't have an account?  diff --git a/resources/js/Pages/Comic/Chapters.jsx b/resources/js/Pages/Comic/Chapters.jsx index 74f0ea5..aefee80 100644 --- a/resources/js/Pages/Comic/Chapters.jsx +++ b/resources/js/Pages/Comic/Chapters.jsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import { Head, Link, router } from '@inertiajs/react'; -import { Plus, Star, ArrowDownNarrowWide, ArrowUpNarrowWide } from 'lucide-react'; +import { Plus, Star, ArrowDownNarrowWide, ArrowUpNarrowWide, ChevronsLeft, ChevronsRight } from 'lucide-react'; import AppLayout from '@/Layouts/AppLayout.jsx'; @@ -12,7 +12,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; import { useToast } from '@/hooks/use-toast'; -export default function Chapters({ auth, comic, chapters, histories }) { +export default function Chapters({ auth, comic, chapters, histories, offset }) { const [group, setGroup] = useState('default'); const [favourites, setFavourites] = useState(auth.user.favourites); @@ -113,11 +113,13 @@ export default function Chapters({ auth, comic, chapters, histories }) { Authors - { comic.comic.author.map(a => ( + + { comic.comic.author.map(a => ( { a.name } - ) ) } + ) ) } + Description @@ -125,7 +127,11 @@ export default function Chapters({ auth, comic, chapters, histories }) { Updated At - { comic.comic.datetime_updated } + + + { comic.comic.datetime_updated } - { comic.comic.last_chapter.name } + + @@ -151,9 +157,23 @@ export default function Chapters({ auth, comic, chapters, histories }) {
+ { (chapters.total > chapters.limit && chapters.offset > 0) && ( + + ) } { chapters.list.sort((a, b) => ascending ? (a.index - b.index) : (b.index - a.index)).map(c => ( ) ) } + { (chapters.total > chapters.limit && chapters.offset === 0) && ( + + ) }
diff --git a/resources/js/Pages/Comic/Histories.jsx b/resources/js/Pages/Comic/Histories.jsx index 54b3d24..67fba0f 100644 --- a/resources/js/Pages/Comic/Histories.jsx +++ b/resources/js/Pages/Comic/Histories.jsx @@ -97,7 +97,7 @@ export default function Histories({ auth, histories }) { { h.comic.name } - { datetimeConversion(h.created_at) } + { datetimeConversion(h.read_at) } )) } diff --git a/resources/js/Pages/Comic/Index.jsx b/resources/js/Pages/Comic/Index.jsx index d09b252..bd01a9b 100644 --- a/resources/js/Pages/Comic/Index.jsx +++ b/resources/js/Pages/Comic/Index.jsx @@ -43,7 +43,7 @@ export default function Index({ comics, offset, auth }) { { props.name } - { props.author.map(a => ( + { props.author && props.author.map(a => ( { a.name } ) diff --git a/resources/js/Pages/Comic/Read.jsx b/resources/js/Pages/Comic/Read.jsx index b5ba5f2..a5785e5 100644 --- a/resources/js/Pages/Comic/Read.jsx +++ b/resources/js/Pages/Comic/Read.jsx @@ -76,7 +76,7 @@ export default function Read({ auth, comic, chapter }) { } else if (divDimensions[0] > divDimensions[1] && readingMode === 'utd') { imgStyles = { width: '50%' }; } else if (readingMode === 'rtl') { - imgStyles = { height: 'calc(100dvh - 90px)' }; + imgStyles = { width: '100%', height: 'calc(100dvh - 90px)', objectFit: 'contain' }; } const handleImageClick = (e) => { @@ -156,6 +156,10 @@ export default function Read({ auth, comic, chapter }) { + + @@ -204,10 +208,6 @@ export default function Read({ auth, comic, chapter }) { ) } - - ); } diff --git a/resources/js/components/ui/app-sidebar.jsx b/resources/js/components/ui/app-sidebar.jsx index 558a891..a1e6615 100644 --- a/resources/js/components/ui/app-sidebar.jsx +++ b/resources/js/components/ui/app-sidebar.jsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { Link, router, usePage } from '@inertiajs/react'; -import { BadgeCheck, ChevronsUpDown, Star, History, ChevronDown, LogOut, Search, Book } from 'lucide-react'; +import { BadgeCheck, ChevronsUpDown, Star, History, ChevronDown, LogOut, Search, Book, TableOfContents } from 'lucide-react'; import { Avatar, AvatarFallback } from '@/components/ui/avatar'; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'; @@ -57,7 +57,7 @@ export function AppSidebar({ auth }) {
Comic - 0.0.0 + 0.0.1
@@ -73,6 +73,21 @@ export function AppSidebar({ auth }) { + + Others + + + + + + + Manual + + + + + + diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php index fc29d19..4216888 100644 --- a/resources/views/app.blade.php +++ b/resources/views/app.blade.php @@ -2,7 +2,7 @@ - + {{ config('app.name', 'Laravel') }} @routes @viteReactRefresh