Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
5rahim committed Mar 24, 2024
1 parent 56c17d2 commit d89a3f1
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 26 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
## v1.1.2

- 🚑️ Fixed bug introduced in v1.1.1 making some pages inaccessible
- 🦺 Removed ambiguous "add to collection" button
- 🦺 Fixed start and completion dates not showing when modifying AniList entries on "My Lists" pages

## v1.1.1

Expand Down
2 changes: 1 addition & 1 deletion internal/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package constants
import "time"

const (
Version = "1.1.1"
Version = "1.1.2"
VersionName = "Robin"
GcTime = time.Minute * 30
ConfigFileName = "config.toml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const LibraryCollectionEntryItem = memo(({ entry }: { entry: LibraryColle
media={entry.media!}
listData={entry.listData}
libraryData={entry.libraryData}
showListDataButton
/>
)
})
7 changes: 7 additions & 0 deletions seanime-web/src/app/(main)/anilist/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,16 @@ const WatchList = React.memo(({ list }: { list: AnilistCollectionList | null | u
progress: entry.progress!,
score: entry.score!,
status: entry.status!,
startedAt: entry.startedAt?.year ? new Date(entry.startedAt.year,
(entry.startedAt.month || 1) - 1,
entry.startedAt.day || 1).toISOString() : undefined,
completedAt: entry.completedAt?.year ? new Date(entry.completedAt.year,
(entry.completedAt.month || 1) - 1,
entry.completedAt.day || 1).toISOString() : undefined,
}}
showLibraryBadge
media={entry.media!}
showListDataButton
/>
))}
</div>
Expand Down
49 changes: 26 additions & 23 deletions seanime-web/src/components/shared/anilist-media-entry-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface AnilistMediaEntryModalProps {
children?: React.ReactNode
listData?: MediaEntryListData
media?: BaseMediaFragment
hideButton?: boolean
}

const entrySchema = defineSchema(({ z, presets }) => z.object({
Expand All @@ -44,7 +45,7 @@ const entrySchema = defineSchema(({ z, presets }) => z.object({
export const AnilistMediaEntryModal: React.FC<AnilistMediaEntryModalProps> = (props) => {
const [open, toggle] = useToggle(false)

const { children, media, listData, ...rest } = props
const { children, media, listData, hideButton, ...rest } = props

const user = useAtomValue(userAtom)

Expand Down Expand Up @@ -78,29 +79,31 @@ export const AnilistMediaEntryModal: React.FC<AnilistMediaEntryModalProps> = (pr

return (
<>
{!!listData && <IconButton
intent="gray-subtle"
icon={<AiFillEdit />}
rounded
size="sm"
onClick={toggle}
/>}
{!hideButton && <>
{!!listData && <IconButton
intent="gray-subtle"
icon={<AiFillEdit />}
rounded
size="sm"
onClick={toggle}
/>}

{(!listData) && <IconButton
intent="primary-subtle"
icon={<BiPlus />}
rounded
size="sm"
className={cn({ "hidden": isSuccess })} // Hide button when mutation is successful
onClick={() => mutate({
mediaId: media?.id || 0,
status: "PLANNING",
score: 0,
progress: 0,
startedAt: null,
completedAt: null,
})}
/>}
{(!listData) && <IconButton
intent="primary-subtle"
icon={<BiPlus />}
rounded
size="sm"
className={cn({ "hidden": isSuccess })} // Hide button when mutation is successful
onClick={() => mutate({
mediaId: media?.id || 0,
status: "PLANNING",
score: 0,
progress: 0,
startedAt: null,
completedAt: null,
})}
/>}
</>}

<Modal
open={open}
Expand Down
5 changes: 3 additions & 2 deletions seanime-web/src/components/shared/anime-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type AnimeListItemProps = {
libraryData?: MediaEntryLibraryData
showLibraryBadge?: boolean
overlay?: React.ReactNode
showListDataButton?: boolean
} & {
containerClassName?: string
}
Expand All @@ -39,7 +40,7 @@ const actionPopupHoverAtom = atom<number | undefined>(undefined)

export const AnimeListItem = ((props: AnimeListItemProps) => {

const { media, listData: _listData, libraryData: _libraryData, overlay } = props
const { media, listData: _listData, libraryData: _libraryData, overlay, showListDataButton } = props

const [listData, setListData] = useState(_listData)
const [libraryData, setLibraryData] = useState(_libraryData)
Expand Down Expand Up @@ -169,7 +170,7 @@ export const AnimeListItem = ((props: AnimeListItemProps) => {
<div className="flex gap-2">
{!!libraryData &&
<LockFilesButton mediaId={media.id} allFilesLocked={libraryData.allFilesLocked} />}
<AnilistMediaEntryModal listData={listData} media={media} />
{showListDataButton && <AnilistMediaEntryModal listData={listData} media={media} />}
</div>
</div>
</div>
Expand Down

0 comments on commit d89a3f1

Please sign in to comment.