mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Fixed types.
This commit is contained in:
parent
8775d696b8
commit
a78d11e352
5 changed files with 74 additions and 64 deletions
|
|
@ -11,10 +11,10 @@ export function MobileMenu({
|
|||
items: any[];
|
||||
className?: string;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
}): any {
|
||||
const pathname = usePathname();
|
||||
|
||||
const Items = ({ items, className }: { items: any[]; className?: string }) => (
|
||||
const Items = ({ items, className }: { items: any[]; className?: string }): any => (
|
||||
<div className={classNames(styles.items, className)}>
|
||||
{items.map(({ label, url, children }: { label: string; url: string; children: any[] }) => {
|
||||
const selected = pathname.startsWith(url);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { useIntl, FormattedMessage } from 'react-intl';
|
||||
import { useIntl, FormattedMessage, MessageDescriptor, PrimitiveType } from 'react-intl';
|
||||
import { messages, labels } from 'components/messages';
|
||||
import { FormatXMLElementFn, Options } from 'intl-messageformat';
|
||||
|
||||
export function useMessages() {
|
||||
export function useMessages(): any {
|
||||
const intl = useIntl();
|
||||
|
||||
const getMessage = (id: string) => {
|
||||
|
|
@ -10,7 +11,16 @@ export function useMessages() {
|
|||
return message ? formatMessage(message) : id;
|
||||
};
|
||||
|
||||
const formatMessage = (descriptor: any, values?: any, opts?: any) => {
|
||||
const formatMessage = (
|
||||
descriptor:
|
||||
| MessageDescriptor
|
||||
| {
|
||||
id: string;
|
||||
defaultMessage: string;
|
||||
},
|
||||
values?: Record<string, PrimitiveType | FormatXMLElementFn<string, string>>,
|
||||
opts?: Options,
|
||||
) => {
|
||||
return descriptor ? intl.formatMessage(descriptor, values, opts) : null;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export function useNavigation() {
|
|||
return obj;
|
||||
}, [params]);
|
||||
|
||||
function makeUrl(params, reset) {
|
||||
function makeUrl(params: any, reset?: boolean) {
|
||||
return reset ? pathname : buildUrl(pathname, { ...query, ...params });
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue