diff --git a/.nvmrc b/.nvmrc index 93b18eeec5..82d5d71434 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -24.17 +24.18 diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 0461b47326..e718a56a4f 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -84,7 +84,7 @@ const preview: Preview = { // Get the locale from the global toolbar // and merge it with any parameters or args state. const { locale } = globals as { locale: string }; - const { state = {} } = parameters; + const { state = {}, stateFn } = parameters; const argsState: Record = {}; for (const [key, value] of Object.entries(args)) { @@ -106,6 +106,16 @@ const preview: Preview = { } } + let stateFnState: Record = {}; + if (typeof stateFn === 'function') { + stateFnState = + ( + stateFn as ( + args: Record, + ) => Record | undefined | null + )(args) ?? {}; + } + const reducer = reducerWithInitialState( { meta: { @@ -113,6 +123,7 @@ const preview: Preview = { }, }, state as Record, + stateFnState, argsState, ); diff --git a/Gemfile.lock b/Gemfile.lock index 79c65b896f..600fe8188f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -292,7 +292,7 @@ GEM activesupport (>= 5.1) haml (>= 4.0.6) railties (>= 5.1) - haml_lint (0.73.0) + haml_lint (0.74.0) haml (>= 5.0) parallel (>= 1.10) rainbow @@ -354,7 +354,7 @@ GEM azure-blob (~> 0.5.2) hashie (~> 5.0) jmespath (1.6.2) - json (2.19.9) + json (2.20.0) json-canonicalization (1.0.0) json-jwt (1.17.1) activesupport (>= 4.2) @@ -832,9 +832,10 @@ GEM concurrent-ruby (~> 1.0, >= 1.0.5) sidekiq (>= 7.0.0, < 9.0.0) thor (>= 1.0, < 3.0) - simple-navigation (4.4.1) - activesupport (>= 2.3.2) - ostruct + simple-navigation (4.5.0) + activesupport (>= 6.1.0) + json + zeitwerk simple_form (5.4.1) actionpack (>= 7.0) activemodel (>= 7.0) diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index b99e0023f4..361d51ffa5 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -9,6 +9,12 @@ module SettingsHelper LanguagesHelper.sorted_locale_keys(I18n.available_locales) end + def inline_qrcode_svg(code) + code + .as_svg(padding: 0, module_size: 4, use_path: true) + .html_safe # rubocop:disable Rails/OutputSafety + end + def featured_tags_hint(recently_used_tags) recently_used_tags.present? && safe_join( diff --git a/app/javascript/entrypoints/public.tsx b/app/javascript/entrypoints/public.tsx index 5563b8324e..848e600895 100644 --- a/app/javascript/entrypoints/public.tsx +++ b/app/javascript/entrypoints/public.tsx @@ -522,14 +522,6 @@ on('click', '.rules-list button', ({ target }) => { * don't produce accessible markup (simple-forms & simple-navigation) */ function applyRailsA11yPatches() { - /** - * Mark current navigation item with aria-current - */ - const activeNavLink = document.querySelector( - '.simple-navigation-active-leaf a.selected', - ); - activeNavLink?.setAttribute('aria-current', 'page'); - /** * Hides the asterisk added to labels of required form fields * from assistive tech. (Those fields already have the `required` attribute) diff --git a/app/javascript/mastodon/actions/importer/statuses.ts b/app/javascript/mastodon/actions/importer/statuses.ts index 7753844953..f34222a299 100644 --- a/app/javascript/mastodon/actions/importer/statuses.ts +++ b/app/javascript/mastodon/actions/importer/statuses.ts @@ -20,7 +20,7 @@ export function normalizeStatus( ) { const normalStatus: StatusShape = { hidden: normalOldStatus?.hidden ?? false, - collapsed: normalOldStatus?.collapsed ?? false, + collapsed: normalOldStatus?.collapsed ?? null, content: '', contentHtml: '', muted: false, diff --git a/app/javascript/mastodon/components/account_header/name.tsx b/app/javascript/mastodon/components/account_header/name.tsx index e66affae1b..4b6f9d1b44 100644 --- a/app/javascript/mastodon/components/account_header/name.tsx +++ b/app/javascript/mastodon/components/account_header/name.tsx @@ -1,12 +1,10 @@ -import { useCallback, useId, useRef, useState } from 'react'; +import { useCallback, useId, useState } from 'react'; import type { FC } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import classNames from 'classnames'; -import Overlay from 'react-overlays/esm/Overlay'; - import { useAccount } from '@/mastodon/hooks/useAccount'; import { useRelationship } from '@/mastodon/hooks/useRelationship'; import { useAppSelector } from '@/mastodon/store'; @@ -20,6 +18,7 @@ import { CopyButton } from '../copy_button'; import { DisplayName } from '../display_name'; import { Icon } from '../icon'; import { NavigationFocusTarget } from '../navigation_focus_target'; +import { Popover } from '../popover'; import { AccountBadges } from './badges'; import classes from './styles.module.scss'; @@ -82,7 +81,8 @@ const AccountNameHelp: FC<{ const accessibilityId = useId(); const intl = useIntl(); const [open, setOpen] = useState(false); - const triggerRef = useRef(null); + const [triggerElement, setTriggerElement] = + useState(null); const handleClick = useCallback(() => { setOpen((prev) => !prev); @@ -94,7 +94,7 @@ const AccountNameHelp: FC<{ <> - } - onHide={handleClick} - offset={[5, 5]} + {({ props }) => (
)} -
+ ); }; diff --git a/app/javascript/mastodon/components/alt_text_badge/index.tsx b/app/javascript/mastodon/components/alt_text_badge/index.tsx index 535ba3d1b6..64e120ea4f 100644 --- a/app/javascript/mastodon/components/alt_text_badge/index.tsx +++ b/app/javascript/mastodon/components/alt_text_badge/index.tsx @@ -4,22 +4,14 @@ import { FormattedMessage, useIntl } from 'react-intl'; import classNames from 'classnames'; -import type { - OffsetValue, - UsePopperOptions, -} from 'react-overlays/esm/usePopper'; -import Overlay from 'react-overlays/Overlay'; - import CloseIcon from '@/material-icons/400-24px/close.svg?react'; import { useSelectableClick } from 'mastodon/hooks/useSelectableClick'; import { IconButton } from '../icon_button'; +import { Popover } from '../popover'; import classes from './styles.module.scss'; -const offset = [0, 4] as OffsetValue; -const popperConfig = { strategy: 'fixed' } as UsePopperOptions; - export const AltTextBadge: React.FC<{ description: string; className?: string; @@ -28,7 +20,9 @@ export const AltTextBadge: React.FC<{ const uniqueId = useId(); const popoverId = `${uniqueId}-popover`; const titleId = `${uniqueId}-title`; - const buttonRef = useRef(null); + const [buttonElement, setButtonElement] = useState( + null, + ); const popoverRef = useRef(null); const [open, setOpen] = useState(false); @@ -41,8 +35,8 @@ export const AltTextBadge: React.FC<{ const handleClose = useCallback(() => { setOpen(false); - buttonRef.current?.focus(); - }, [setOpen]); + buttonElement?.focus(); + }, [buttonElement]); const [handleMouseDown, handleMouseUp] = useSelectableClick(handleClose); @@ -50,7 +44,7 @@ export const AltTextBadge: React.FC<{ <>