Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/logo_full_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/logo_stacked_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 1 addition & 7 deletions src/components/CollectionDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,7 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
fill
priority
/>
<div
className="absolute inset-0"
style={{
backgroundImage:
'linear-gradient(180deg, rgba(17, 24, 39, 0.47) 0%, rgba(17, 24, 39, 1) 100%)',
}}
/>
<div className="media-page-bg-overlay absolute inset-0" />
</div>
)}
<PageTitle title={data.name} />
Expand Down
39 changes: 39 additions & 0 deletions src/components/Common/SeerrLogo/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Image, { type ImageProps } from 'next/image';

type SeerrLogoVariant = 'full' | 'stacked';

interface SeerrLogoProps extends Omit<ImageProps, 'alt' | 'src'> {
alt?: string;
variant: SeerrLogoVariant;
}

const getLogoSrc = (variant: SeerrLogoVariant, light = false) =>
`/logo_${variant}${light ? '_light' : ''}.svg`;

const withLogoClass = (className: string | undefined, logoClass: string) =>
[className, 'seerr-logo', logoClass].filter(Boolean).join(' ');

const SeerrLogo = ({
alt = 'Logo',
className,
variant,
...props
}: SeerrLogoProps) => (
<>
<Image
{...props}
src={getLogoSrc(variant)}
alt={alt}
className={withLogoClass(className, 'seerr-logo-dark')}
/>
<Image
{...props}
src={getLogoSrc(variant, true)}
alt=""
aria-hidden
Comment on lines +32 to +33

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the logo link name in light mode

When the light theme is active, CSS hides .seerr-logo-dark and shows .seerr-logo-light, but the visible image is explicitly empty and aria-hidden. The sidebar/login logo links then have no accessible name in light mode for screen reader users; give the light asset the same alt text, or only hide the inactive asset from assistive tech.

Useful? React with 👍 / 👎.

className={withLogoClass(className, 'seerr-logo-light')}
/>
</>
);

export default SeerrLogo;
2 changes: 1 addition & 1 deletion src/components/CompanyCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CompanyCard = ({ image, url, name }: CompanyCardProps) => {
return (
<Link
href={url}
className={`relative flex h-32 w-56 transform-gpu cursor-pointer items-center justify-center p-8 shadow ring-1 transition duration-300 ease-in-out sm:h-36 sm:w-72 ${
className={`company-card relative flex h-32 w-56 transform-gpu cursor-pointer items-center justify-center p-8 shadow ring-1 transition duration-300 ease-in-out sm:h-36 sm:w-72 ${
isHovered
? 'scale-105 bg-gray-700 ring-gray-500'
: 'scale-100 bg-gray-800 ring-gray-700'
Expand Down
8 changes: 1 addition & 7 deletions src/components/IssueDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,7 @@ const IssueDetails = () => {
fill
priority
/>
<div
className="absolute inset-0"
style={{
backgroundImage:
'linear-gradient(180deg, rgba(17, 24, 39, 0.47) 0%, rgba(17, 24, 39, 1) 100%)',
}}
/>
<div className="media-page-bg-overlay absolute inset-0" />
</div>
)}
<div className="media-header">
Expand Down
11 changes: 3 additions & 8 deletions src/components/Layout/Sidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Badge from '@app/components/Common/Badge';
import SeerrLogo from '@app/components/Common/SeerrLogo';
import VersionStatus from '@app/components/Layout/VersionStatus';
import useClickOutside from '@app/hooks/useClickOutside';
import { Permission, useUser } from '@app/hooks/useUser';
Expand All @@ -15,7 +16,6 @@ import {
UsersIcon,
XMarkIcon,
} from '@heroicons/react/24/outline';
import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/router';
import { Fragment, useEffect, useRef } from 'react';
Expand Down Expand Up @@ -192,7 +192,7 @@ const Sidebar = ({
<div className="flex flex-shrink-0 items-center px-2">
<span className="w-full px-4 text-xl text-gray-50">
<Link href="/" className="relative block h-24 w-64">
<Image src="/logo_full.svg" alt="Logo" fill />
<SeerrLogo variant="full" alt="Logo" fill />
</Link>
</span>
</div>
Expand Down Expand Up @@ -255,12 +255,7 @@ const Sidebar = ({
<div className="flex flex-shrink-0 items-center">
<span className="w-full px-4 py-2 text-2xl text-gray-50">
<Link href="/" className="relative block h-24">
<Image
src="/logo_full.svg"
alt="Logo"
fill
loading="eager"
/>
<SeerrLogo variant="full" alt="Logo" fill loading="eager" />
</Link>
</span>
</div>
Expand Down
32 changes: 32 additions & 0 deletions src/components/Layout/UserDropdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import CachedImage from '@app/components/Common/CachedImage';
import MiniQuotaDisplay from '@app/components/Layout/UserDropdown/MiniQuotaDisplay';
import useTheme from '@app/hooks/useTheme';
import { Permission, useUser } from '@app/hooks/useUser';
import defineMessages from '@app/utils/defineMessages';
import { Menu, Transition } from '@headlessui/react';
import {
ArrowRightOnRectangleIcon,
ClockIcon,
MoonIcon,
SunIcon,
} from '@heroicons/react/24/outline';
import { CogIcon, UserIcon } from '@heroicons/react/24/solid';
import axios from 'axios';
Expand All @@ -18,6 +21,8 @@ const messages = defineMessages('components.Layout.UserDropdown', {
myprofile: 'Profile',
settings: 'Settings',
requests: 'Requests',
switchtodark: 'Switch to Dark Theme',
switchtolight: 'Switch to Light Theme',
signout: 'Sign Out',
});

Expand All @@ -37,6 +42,7 @@ ForwardedLink.displayName = 'ForwardedLink';
const UserDropdown = () => {
const intl = useIntl();
const { user, revalidate, hasPermission } = useUser();
const { theme, toggleTheme } = useTheme();

const logout = async () => {
const response = await axios.post('/api/v1/auth/logout');
Expand Down Expand Up @@ -154,6 +160,32 @@ const UserDropdown = () => {
</ForwardedLink>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<button
type="button"
className={`flex w-full items-center rounded px-4 py-2 text-sm font-medium text-gray-200 transition duration-150 ease-in-out ${
active
? 'bg-gradient-to-br from-indigo-600 to-purple-600 text-white'
: ''
}`}
onClick={toggleTheme}
>
{theme === 'light' ? (
<MoonIcon className="mr-2 inline h-5 w-5" />
) : (
<SunIcon className="mr-2 inline h-5 w-5" />
)}
<span>
{intl.formatMessage(
theme === 'light'
? messages.switchtodark
: messages.switchtolight
)}
</span>
</button>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<a
Expand Down
4 changes: 2 additions & 2 deletions src/components/Login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PlexLogo from '@app/assets/services/plex.svg';
import Button from '@app/components/Common/Button';
import ImageFader from '@app/components/Common/ImageFader';
import PageTitle from '@app/components/Common/PageTitle';
import SeerrLogo from '@app/components/Common/SeerrLogo';
import LanguagePicker from '@app/components/Layout/LanguagePicker';
import JellyfinLogin from '@app/components/Login/JellyfinLogin';
import LocalLogin from '@app/components/Login/LocalLogin';
Expand All @@ -16,7 +17,6 @@ import { XCircleIcon } from '@heroicons/react/24/solid';
import { MediaServerType } from '@server/constants/server';
import axios from 'axios';
import { useRouter } from 'next/dist/client/router';
import Image from 'next/image';
import { useEffect, useRef, useState, type JSX } from 'react';
import { useIntl } from 'react-intl';
import { CSSTransition, SwitchTransition } from 'react-transition-group';
Expand Down Expand Up @@ -164,7 +164,7 @@ const Login = () => {
</div>
<div className="relative z-40 mt-10 flex flex-col items-center px-4 sm:mx-auto sm:w-full sm:max-w-md">
<div className="relative h-48 w-full max-w-full">
<Image src="/logo_stacked.svg" alt="Logo" fill />
<SeerrLogo variant="stacked" alt="Logo" fill />
</div>
</div>
<div className="relative z-50 mt-8 sm:mx-auto sm:w-full sm:max-w-md">
Expand Down
Loading