nicolium: cleanup

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-02-25 23:44:24 +01:00
parent 1e029b5d05
commit d7852da5e5
9 changed files with 46 additions and 51 deletions

View File

@ -10,7 +10,7 @@ interface IGroupAvatar {
withRing?: boolean;
}
const GroupAvatar = (props: IGroupAvatar) => {
const GroupAvatar: React.FC<IGroupAvatar> = (props) => {
const { group, size, withRing = false } = props;
const isOwner = group.relationship?.role === GroupRoles.OWNER;

View File

@ -23,7 +23,7 @@ interface IGroupPopoverContainer {
group: Group;
}
const GroupPopover = (props: IGroupPopoverContainer) => {
const GroupPopover: React.FC<IGroupPopoverContainer> = (props) => {
const { children, group, isEnabled } = props;
const shouldHideAction = !!useMatch({ from: groupTimelineRoute.fullPath, shouldThrow: false });

View File

@ -21,54 +21,49 @@ interface ISidebarNavigationLink extends Partial<LinkOptions> {
}
/** Desktop sidebar navigation link. */
const SidebarNavigationLink = React.memo(
React.forwardRef(
(
props: ISidebarNavigationLink,
ref: React.ForwardedRef<HTMLAnchorElement>,
): React.JSX.Element => {
const { icon, activeIcon, text, to, count, countMax, onClick, ...rest } = props;
const SidebarNavigationLink: React.FC<ISidebarNavigationLink> = React.memo(
React.forwardRef((props, ref: React.ForwardedRef<HTMLAnchorElement>): React.JSX.Element => {
const { icon, activeIcon, text, to, count, countMax, onClick, ...rest } = props;
const matchRoute = useMatchRoute();
const { demetricator } = useSettings();
const matchRoute = useMatchRoute();
const { demetricator } = useSettings();
const LinkComponent = (to === undefined ? 'button' : Link) as typeof Link;
const LinkComponent = (to === undefined ? 'button' : Link) as typeof Link;
const isActive = matchRoute({ to }) !== false;
const isActive = matchRoute({ to }) !== false;
const handleClick: React.EventHandler<React.MouseEvent> = (e) => {
if (onClick) {
onClick(e);
e.preventDefault();
e.stopPropagation();
}
};
const handleClick: React.EventHandler<React.MouseEvent> = (e) => {
if (onClick) {
onClick(e);
e.preventDefault();
e.stopPropagation();
}
};
return (
<li>
<LinkComponent
activeOptions={{ exact: true }}
activeProps={{ className: '⁂-sidebar-navigation-link--active' }}
to={to}
ref={ref}
onClick={handleClick}
className='⁂-sidebar-navigation-link'
{...rest}
>
<span className='⁂-sidebar-navigation-link__icon' aria-hidden>
<Icon
src={(isActive && activeIcon) || icon}
count={demetricator ? undefined : count}
countMax={countMax}
/>
</span>
return (
<li>
<LinkComponent
activeOptions={{ exact: true }}
activeProps={{ className: '⁂-sidebar-navigation-link--active' }}
to={to}
ref={ref}
onClick={handleClick}
className='⁂-sidebar-navigation-link'
{...rest}
>
<span className='⁂-sidebar-navigation-link__icon' aria-hidden>
<Icon
src={(isActive && activeIcon) || icon}
count={demetricator ? undefined : count}
countMax={countMax}
/>
</span>
<p>{text}</p>
</LinkComponent>
</li>
);
},
),
<p>{text}</p>
</LinkComponent>
</li>
);
}),
(prevProps, nextProps) => prevProps.count === nextProps.count,
);

View File

@ -9,7 +9,7 @@ interface IStatusInfo {
title?: string;
}
const StatusInfo = (props: IStatusInfo) => {
const StatusInfo: React.FC<IStatusInfo> = (props) => {
const { avatarSize, icon, text, className, title } = props;
const onClick = (event: React.MouseEvent<HTMLDivElement>) => {

View File

@ -42,7 +42,7 @@ interface IAvatar extends Pick<IStillImage, 'alt' | 'src' | 'staticSrc' | 'onErr
const fac = new FastAverageColor();
/** Round profile avatar for accounts. */
const Avatar = (props: IAvatar) => {
const Avatar: React.FC<IAvatar> = (props) => {
const intl = useIntl();
const { disableUserProvidedMedia } = useSettings();

View File

@ -20,8 +20,8 @@ interface IIconButton extends React.ButtonHTMLAttributes<HTMLButtonElement> {
}
/** A clickable icon. */
const IconButton = React.forwardRef(
(props: IIconButton, ref: React.ForwardedRef<HTMLButtonElement>): React.JSX.Element => {
const IconButton: React.FC<IIconButton> = React.forwardRef(
(props, ref: React.ForwardedRef<HTMLButtonElement>): React.JSX.Element => {
const { src, className, iconClassName, text, theme = 'seamless', ...filteredProps } = props;
const Component = (props.href ? 'a' : 'button') as 'button';

View File

@ -36,7 +36,7 @@ interface IToast {
/**
* Customizable Toasts for in-app notifications.
*/
const Toast = (props: IToast) => {
const Toast: React.FC<IToast> = (props) => {
const { t, message, type, action, actionLinkOptions, actionLabel, summary } = props;
const intl = useIntl();

View File

@ -20,7 +20,7 @@ interface IChatPaneHeader {
secondaryActionTitle?: string;
}
const ChatPaneHeader = (props: IChatPaneHeader) => {
const ChatPaneHeader: React.FC<IChatPaneHeader> = (props) => {
const {
isOpen,
isToggleable = true,

View File

@ -13,7 +13,7 @@ interface IReplyGroupIndicator {
composeId: string;
}
const ReplyGroupIndicator = (props: IReplyGroupIndicator) => {
const ReplyGroupIndicator: React.FC<IReplyGroupIndicator> = (props) => {
const { composeId } = props;
const getStatus = useCallback(makeGetStatus(), []);