Display logo if set
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
d5737bd6de
commit
25defe0691
5 changed files with 17 additions and 4 deletions
|
@ -6,11 +6,12 @@ import { useStatContext } from 'pl-fe/contexts/stat-context';
|
|||
import Search from 'pl-fe/features/search/components/search';
|
||||
import ComposeButton from 'pl-fe/features/ui/components/compose-button';
|
||||
import ProfileDropdown from 'pl-fe/features/ui/components/profile-dropdown';
|
||||
import { useAppSelector, useFeatures, useOwnAccount, useSettings, useInstance, useRegistrationStatus } from 'pl-fe/hooks';
|
||||
import { useAppSelector, useFeatures, useOwnAccount, useSettings, useInstance, useRegistrationStatus, useLogo } from 'pl-fe/hooks';
|
||||
|
||||
import Account from './account';
|
||||
import DropdownMenu, { Menu } from './dropdown-menu';
|
||||
import SidebarNavigationLink from './sidebar-navigation-link';
|
||||
import SiteLogo from './site-logo';
|
||||
|
||||
const messages = defineMessages({
|
||||
followRequests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
|
||||
|
@ -35,6 +36,7 @@ const SidebarNavigation = () => {
|
|||
const { isDeveloper } = useSettings();
|
||||
const { account } = useOwnAccount();
|
||||
const { isOpen } = useRegistrationStatus();
|
||||
const logoSrc = useLogo();
|
||||
|
||||
const notificationCount = useAppSelector((state) => state.notifications.unread);
|
||||
const followRequestsCount = useAppSelector((state) => state.user_lists.follow_requests.items.count());
|
||||
|
@ -139,6 +141,9 @@ const SidebarNavigation = () => {
|
|||
|
||||
return (
|
||||
<Stack space={4}>
|
||||
{logoSrc && (
|
||||
<SiteLogo className='h-12 w-auto cursor-pointer' />
|
||||
)}
|
||||
|
||||
{account && (
|
||||
<Stack space={4}>
|
||||
|
|
|
@ -80,7 +80,7 @@ const SiteErrorBoundary: React.FC<ISiteErrorBoundary> = ({ children }) => {
|
|||
{logoSrc && (
|
||||
<div className='flex shrink-0 justify-center'>
|
||||
<a href='/' className='inline-flex'>
|
||||
<SiteLogo alt='Logo' className='h-12 w-auto cursor-pointer' />
|
||||
<SiteLogo className='h-12 w-auto cursor-pointer' />
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
import clsx from 'clsx';
|
||||
import React from 'react';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import { useLogo } from 'pl-fe/hooks';
|
||||
|
||||
const messages = defineMessages({
|
||||
logo: { id: 'generic.logo', defaultMessage: 'Logo' },
|
||||
});
|
||||
|
||||
interface ISiteLogo extends React.ComponentProps<'img'> {
|
||||
/** Extra class names for the <img> element. */
|
||||
className?: string;
|
||||
|
@ -12,6 +17,7 @@ interface ISiteLogo extends React.ComponentProps<'img'> {
|
|||
|
||||
/** Display the most appropriate site logo based on the theme and configuration. */
|
||||
const SiteLogo: React.FC<ISiteLogo> = ({ className, theme, ...rest }) => {
|
||||
const intl = useIntl();
|
||||
const logoSrc = useLogo();
|
||||
|
||||
if (!logoSrc) return null;
|
||||
|
@ -19,6 +25,7 @@ const SiteLogo: React.FC<ISiteLogo> = ({ className, theme, ...rest }) => {
|
|||
return (
|
||||
// eslint-disable-next-line jsx-a11y/alt-text
|
||||
<img
|
||||
alt={intl.formatMessage(messages.logo)}
|
||||
className={clsx('object-contain', className)}
|
||||
src={logoSrc}
|
||||
{...rest}
|
||||
|
|
|
@ -25,7 +25,7 @@ const DevelopersChallenge = () => {
|
|||
};
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (answer === 'boxsoap') {
|
||||
if (answer === 'fe-pl') {
|
||||
dispatch(changeSettingImmediate(['isDeveloper'], true));
|
||||
toast.success(intl.formatMessage(messages.success));
|
||||
} else {
|
||||
|
@ -34,7 +34,7 @@ const DevelopersChallenge = () => {
|
|||
};
|
||||
|
||||
const challenge = `function plFe() {
|
||||
return 'soap|box'.split('|').reverse().join('');
|
||||
return 'pl-fe'.split('-').reverse().join('-');
|
||||
}`;
|
||||
|
||||
return (
|
||||
|
|
|
@ -816,6 +816,7 @@
|
|||
"gdpr.learn_more": "Learn more",
|
||||
"gdpr.message": "{siteTitle} uses session cookies, which are essential to the website's functioning.",
|
||||
"gdpr.title": "{siteTitle} uses cookies",
|
||||
"generic.logo": "Logo",
|
||||
"generic.saved": "Saved",
|
||||
"getting_started.open_source_notice": "{code_name} is open source software. You can contribute or report issues at {code_link} (v{code_version}).",
|
||||
"group.cancel_request": "Cancel request",
|
||||
|
|
Loading…
Reference in a new issue