Fix ios-font-problem - Arabic/Javanese

This commit is contained in:
danidfra 2024-11-18 22:22:14 -03:00
parent 4637e208b2
commit 129df7cfe3
4 changed files with 19 additions and 8 deletions

View File

@ -42,7 +42,7 @@
"@emoji-mart/data": "^1.2.1", "@emoji-mart/data": "^1.2.1",
"@floating-ui/react": "^0.26.0", "@floating-ui/react": "^0.26.0",
"@fontsource/inter": "^5.0.0", "@fontsource/inter": "^5.0.0",
"@fontsource/noto-sans-javanese": "^5.0.16", "@fontsource/noto-sans-javanese": "^5.1.0",
"@fontsource/roboto-mono": "^5.0.0", "@fontsource/roboto-mono": "^5.0.0",
"@fontsource/vazirmatn": "^5.0.20", "@fontsource/vazirmatn": "^5.0.20",
"@gamestdio/websocket": "^0.3.2", "@gamestdio/websocket": "^0.3.2",

View File

@ -25,6 +25,14 @@ const SoapboxHead: React.FC<ISoapboxHead> = ({ children }) => {
const themeCss = generateThemeCss(demo ? normalizeSoapboxConfig({ brandColor: '#0482d8' }) : soapboxConfig); const themeCss = generateThemeCss(demo ? normalizeSoapboxConfig({ brandColor: '#0482d8' }) : soapboxConfig);
const dsn = soapboxConfig.sentryDsn; const dsn = soapboxConfig.sentryDsn;
const loadLocaleCss = async (locale: string) => {
if (locale === 'ar') {
await import('soapbox/styles/i18n/arabic.css');
} else if (locale === 'jv') {
await import('soapbox/styles/i18n/javanese.css');
}
};
const bodyClass = clsx('h-full bg-white text-base black:bg-black dark:bg-gray-800', { const bodyClass = clsx('h-full bg-white text-base black:bg-black dark:bg-gray-800', {
'no-reduce-motion': !reduceMotion, 'no-reduce-motion': !reduceMotion,
'underline-links': underlineLinks, 'underline-links': underlineLinks,
@ -32,10 +40,12 @@ const SoapboxHead: React.FC<ISoapboxHead> = ({ children }) => {
}); });
useEffect(() => { useEffect(() => {
loadLocaleCss(locale);
if (dsn) { if (dsn) {
startSentry(dsn).catch(console.error); startSentry(dsn).catch(console.error);
} }
}, [dsn]); }, [dsn, locale]);
return ( return (
<> <>
@ -46,6 +56,9 @@ const SoapboxHead: React.FC<ISoapboxHead> = ({ children }) => {
{themeCss && <style id='theme' type='text/css'>{`:root{${themeCss}}`}</style>} {themeCss && <style id='theme' type='text/css'>{`:root{${themeCss}}`}</style>}
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{['dark', 'black'].includes(theme) && <style type='text/css'>{':root { color-scheme: dark; }'}</style>} {['dark', 'black'].includes(theme) && <style type='text/css'>{':root { color-scheme: dark; }'}</style>}
{/* eslint-disable formatjs/no-literal-string-in-jsx */}
{(locale === 'ar' || locale === 'jv') ? <style type='text/css'>{':root { font-family: \'Soapbox i18n\'; }'}</style> : <style type='text/css'>{':root { font-family: \'Inter\'; }'}</style>}
{/* eslint-enable formatjs/no-literal-string-in-jsx */}
<meta name='theme-color' content={soapboxConfig.brandColor} /> <meta name='theme-color' content={soapboxConfig.brandColor} />
</Helmet> </Helmet>

View File

@ -17,8 +17,6 @@ import 'line-awesome/dist/font-awesome-line-awesome/css/all.css';
import 'soapbox/features/nostr/keyring.ts'; import 'soapbox/features/nostr/keyring.ts';
import './iframe.ts'; import './iframe.ts';
import './styles/i18n/arabic.css';
import './styles/i18n/javanese.css';
import './styles/tailwind.css'; import './styles/tailwind.css';
import ready from './ready.ts'; import ready from './ready.ts';

View File

@ -1312,10 +1312,10 @@
resolved "https://registry.yarnpkg.com/@fontsource/inter/-/inter-5.0.8.tgz#61b50cb0eb72b14ae1938d47c4a9a91546d2a50c" resolved "https://registry.yarnpkg.com/@fontsource/inter/-/inter-5.0.8.tgz#61b50cb0eb72b14ae1938d47c4a9a91546d2a50c"
integrity sha512-28knWH1BfOiRalfLs90U4sge5mpQ8ZH6FS0PTT+IZMKrZ7wNHDHRuKa1kQJg+uHcc6axBppnxll+HXM4c7zo/Q== integrity sha512-28knWH1BfOiRalfLs90U4sge5mpQ8ZH6FS0PTT+IZMKrZ7wNHDHRuKa1kQJg+uHcc6axBppnxll+HXM4c7zo/Q==
"@fontsource/noto-sans-javanese@^5.0.16": "@fontsource/noto-sans-javanese@^5.1.0":
version "5.0.16" version "5.1.0"
resolved "https://registry.yarnpkg.com/@fontsource/noto-sans-javanese/-/noto-sans-javanese-5.0.16.tgz#e6a2acad3b520e379a5f760196246951d6d7eb3e" resolved "https://registry.yarnpkg.com/@fontsource/noto-sans-javanese/-/noto-sans-javanese-5.1.0.tgz#bfae45a2324d40e2bc1e5b14479a7d47ae59c7a7"
integrity sha512-foh5yX/kbY28QMx6jU8aezMLAnBTKscNAVeuDIt8myScEDqXDm+1v2pIxVCh0zZUyxt/Yj/qkDTOM/Vegq9hzA== integrity sha512-N3yvfUucmc5hC5ksxdd8DYHTGgx1rMqfgZm4qZ5T1TNMe+773exqGAKVYgdgzCyLCxdOVHQui9ATEeO8hr1Nqg==
"@fontsource/roboto-mono@^5.0.0": "@fontsource/roboto-mono@^5.0.0":
version "5.0.8" version "5.0.8"