little oopsie with the intl stuff

merge-requests/3361/merge^2
Siddharth Singh 2025-04-01 13:52:25 +05:30
rodzic 53c6da35ff
commit 0679b44652
Nie znaleziono w bazie danych klucza dla tego podpisu
2 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
import CloseIcon from '@tabler/icons/outline/x.svg';
import { FC } from 'react';
import { useIntl } from 'react-intl';
import { defineMessages, useIntl } from 'react-intl';
import { Card, CardHeader, CardBody } from 'soapbox/components/ui/card.tsx';
import Icon from 'soapbox/components/ui/icon.tsx';
@ -8,6 +8,10 @@ import { PolicySpecItem, PolicyItem, PolicyState, PolicyAction } from 'soapbox/u
import { PolicyFields } from './PolicyFields.tsx';
const messages = defineMessages({
removePolicy: { id: 'admin.policies.remove_policy', defaultMessage: 'Remove policy' },
});
export const Policy: FC<{
policy: PolicySpecItem;
registry: PolicyItem[];
@ -30,6 +34,7 @@ export const Policy: FC<{
<button
onClick={handleRemovePolicy}
className='ml-2 text-gray-500 hover:text-gray-100'
aria-label={intl.formatMessage(messages.removePolicy)}
>
<Icon src={CloseIcon} className='size-4' />
</button>

Wyświetl plik

@ -16,11 +16,12 @@ const messages = defineMessages({
const MultiValueBadge: FC<{
value: string | number;
onRemove: () => void;
}> = ({ value, onRemove }) => {
intl: ReturnType<typeof useIntl>;
}> = ({ value, onRemove, intl }) => {
return (
<div className='mb-2 mr-2 inline-flex items-center rounded-full bg-gray-200 px-2 py-1 text-gray-800'>
<span className='mr-1 max-w-28 overflow-hidden text-ellipsis' title={String(value)}>{value}</span>
<button onClick={onRemove} className='text-gray-600 hover:text-gray-800' aria-label={messages.removeValue.defaultMessage}>
<button onClick={onRemove} className='text-gray-600 hover:text-gray-800' aria-label={intl.formatMessage(messages.removeValue)}>
<Icon src={CloseIcon} className='size-4' />
</button>
</div>
@ -115,6 +116,7 @@ export const PolicyFields: FC<{
{((value || []) as (string | number)[]).map((v) => (
<MultiValueBadge
key={v}
intl={intl}
value={v}
onRemove={() => handleRemoveMultiValue(v)}
/>