mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-04-17 10:36:19 -05:00
Fix icon titles
This commit is contained in:
parent
ecb7c578c9
commit
a661f91efb
|
|
@ -2,8 +2,13 @@ import React from 'react';
|
|||
import { Platform, Text } from 'react-native';
|
||||
import { svg_styles } from './util.js';
|
||||
|
||||
const IconWeb = React.memo(() => <Text>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style={svg_styles}><path fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="32" d="M256 112v288M400 256H112"/></svg>
|
||||
const IconWeb = React.memo((props: {
|
||||
title?: string;
|
||||
}) => <Text>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style={svg_styles}>
|
||||
{props.title ? <title>{props.title}</title> : null}
|
||||
<path fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="32" d="M256 112v288M400 256H112"/>
|
||||
</svg>
|
||||
</Text>);
|
||||
|
||||
export default Platform.OS === 'web' ? IconWeb : React.memo(() => null);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,13 @@ import React from 'react';
|
|||
import { Platform, Text } from 'react-native';
|
||||
import { svg_styles } from './util.js';
|
||||
|
||||
const IconWeb = React.memo(() => <Text>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" style={svg_styles}><path d="M449.07,399.08,278.64,82.58c-12.08-22.44-44.26-22.44-56.35,0L51.87,399.08A32,32,0,0,0,80,446.25H420.89A32,32,0,0,0,449.07,399.08Zm-198.6-1.83a20,20,0,1,1,20-20A20,20,0,0,1,250.47,397.25ZM272.19,196.1l-5.74,122a16,16,0,0,1-32,0l-5.74-121.95v0a21.73,21.73,0,0,1,21.5-22.69h.21a21.74,21.74,0,0,1,21.73,22.7Z"/></svg>
|
||||
const IconWeb = React.memo((props: {
|
||||
title?: string;
|
||||
}) => <Text>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" style={svg_styles}>
|
||||
{props.title ? <title>{props.title}</title> : null}
|
||||
<path d="M449.07,399.08,278.64,82.58c-12.08-22.44-44.26-22.44-56.35,0L51.87,399.08A32,32,0,0,0,80,446.25H420.89A32,32,0,0,0,449.07,399.08Zm-198.6-1.83a20,20,0,1,1,20-20A20,20,0,0,1,250.47,397.25ZM272.19,196.1l-5.74,122a16,16,0,0,1-32,0l-5.74-121.95v0a21.73,21.73,0,0,1,21.5-22.69h.21a21.74,21.74,0,0,1,21.73,22.7Z"/>
|
||||
</svg>
|
||||
</Text>);
|
||||
|
||||
export default Platform.OS === 'web' ? IconWeb : React.memo(() => null);
|
||||
|
|
|
|||
|
|
@ -24,10 +24,7 @@ export default function Friends(props: {
|
|||
}, [props.user.user.id]);
|
||||
|
||||
const header_buttons = <TouchableOpacity onPress={showAddFriendModal} style={styles.iconTouchable}>
|
||||
<Text style={[styles.icon, {color: '#' + accent_colour}]} accessibilityLabel={t('add')!}
|
||||
// @ts-expect-error react-native-web
|
||||
title={t('add')!}
|
||||
><AddOutline /></Text>
|
||||
<Text style={[styles.icon, {color: '#' + accent_colour}]}><AddOutline title={t('add')!} /></Text>
|
||||
</TouchableOpacity>;
|
||||
|
||||
return <Section title={t('title')} loading={props.loading} error={props.error} headerButtons={header_buttons}>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React, { useCallback } from 'react';
|
||||
import { ActivityIndicator, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { useAccentColour, useColourScheme } from '../util.js';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BORDER_COLOUR_LIGHT, BORDER_COLOUR_SECONDARY_DARK, TEXT_COLOUR_DARK, TEXT_COLOUR_LIGHT } from '../constants.js';
|
||||
import ipc from '../ipc.js';
|
||||
import Warning from '../components/icons/warning.js';
|
||||
|
|
@ -13,6 +14,7 @@ export default function Section(props: React.PropsWithChildren<{
|
|||
}>) {
|
||||
const theme = useColourScheme() === 'light' ? light : dark;
|
||||
const accent_colour = useAccentColour();
|
||||
const { t, i18n } = useTranslation('main_window', { keyPrefix: 'main_section' });
|
||||
|
||||
const showErrorDetails = useCallback(() => {
|
||||
alert(props.error);
|
||||
|
|
@ -24,7 +26,7 @@ export default function Section(props: React.PropsWithChildren<{
|
|||
{props.loading ? <ActivityIndicator style={styles.activityIndicator} size={HEADER_SIZE}
|
||||
color={'#' + accent_colour} /> :
|
||||
props.error ? <TouchableOpacity onPress={showErrorDetails} style={styles.iconTouchable}>
|
||||
<Text style={[styles.icon, {color: '#' + accent_colour}]}><Warning /></Text>
|
||||
<Text style={[styles.icon, {color: '#' + accent_colour}]}><Warning title={t('section_error')!} /></Text>
|
||||
</TouchableOpacity> : null}
|
||||
{props.headerButtons}
|
||||
</View>
|
||||
|
|
|
|||
|
|
@ -128,6 +128,8 @@ export const main_window = {
|
|||
desc_2: 'Login to the Nintendo Switch Online app to view details here, or use the nxapi command to access Parental Controls data.',
|
||||
login: 'Login',
|
||||
},
|
||||
|
||||
section_error: 'Error updating data',
|
||||
},
|
||||
|
||||
discord_section: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user