Merge branch 'dev' into crowdin-live-translate
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
IconPlug,
|
||||
} from '@tabler/icons-react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { removeTrailingSlash } from 'next/dist/shared/lib/router/utils/remove-trailing-slash';
|
||||
import { useState } from 'react';
|
||||
import { useConfigContext } from '~/config/provider';
|
||||
import { useConfigStore } from '~/config/store';
|
||||
@@ -90,6 +91,8 @@ export const EditAppModal = ({
|
||||
return;
|
||||
}
|
||||
|
||||
values.url = removeTrailingSlash(values.url);
|
||||
|
||||
updateConfig(
|
||||
configName,
|
||||
(previousConfig) => ({
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Stack, Tabs, Text, TextInput } from '@mantine/core';
|
||||
import { Anchor, Button, Card, Collapse, Group, Stack, Tabs, Text, TextInput } from '@mantine/core';
|
||||
import { UseFormReturnType } from '@mantine/form';
|
||||
import { useDisclosure } from '@mantine/hooks';
|
||||
import { IconClick, IconCursorText, IconLink } from '@tabler/icons-react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { AppType } from '~/types/app';
|
||||
@@ -13,6 +14,19 @@ interface GeneralTabProps {
|
||||
|
||||
export const GeneralTab = ({ form, openTab }: GeneralTabProps) => {
|
||||
const { t } = useTranslation('layout/modals/add-app');
|
||||
|
||||
const [opened, { toggle }] = useDisclosure(false);
|
||||
|
||||
const commonMistakes = [
|
||||
t('general.internalAddress.troubleshoot.lines.nothingAfterPort'),
|
||||
t('general.internalAddress.troubleshoot.lines.protocolCheck'),
|
||||
t('general.internalAddress.troubleshoot.lines.preferIP'),
|
||||
t('general.internalAddress.troubleshoot.lines.enablePings'),
|
||||
t('general.internalAddress.troubleshoot.lines.wget'),
|
||||
t('general.internalAddress.troubleshoot.lines.iframe'),
|
||||
t('general.internalAddress.troubleshoot.lines.clearCache'),
|
||||
];
|
||||
|
||||
return (
|
||||
<Tabs.Panel value="general" pt="sm">
|
||||
<Stack spacing="xs">
|
||||
@@ -46,6 +60,27 @@ export const GeneralTab = ({ form, openTab }: GeneralTabProps) => {
|
||||
{...form.getInputProps('behaviour.externalUrl')}
|
||||
/>
|
||||
|
||||
<Collapse in={opened}>
|
||||
<Card withBorder>
|
||||
<Text>{t('general.internalAddress.troubleshoot.header')}</Text>
|
||||
{commonMistakes.map((value: string, key: number) => {
|
||||
return (
|
||||
<Group key={key} display="flex" style={{ alignItems: 'start' }}>
|
||||
<Text>•</Text>
|
||||
<Text style={{ flex: '1' }}>{value}</Text>
|
||||
</Group>
|
||||
);
|
||||
})}
|
||||
<Text>
|
||||
{t('general.internalAddress.troubleshoot.footer').split('{{discord}}')[0]}
|
||||
<Anchor href="https://discord.gg/aCsmEV5RgA" target="_blank">
|
||||
Discord
|
||||
</Anchor>
|
||||
{t('general.internalAddress.troubleshoot.footer').split('{{discord}}')[1]}
|
||||
</Text>
|
||||
</Card>
|
||||
</Collapse>
|
||||
|
||||
{!form.values.behaviour.externalUrl.startsWith('https://') &&
|
||||
!form.values.behaviour.externalUrl.startsWith('http://') && (
|
||||
<Text color="red" mt="sm" size="sm">
|
||||
@@ -53,6 +88,10 @@ export const GeneralTab = ({ form, openTab }: GeneralTabProps) => {
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
<Button onClick={toggle} bottom={-68} left={0} color="yellow.7" variant="light">
|
||||
{t('general.internalAddress.troubleshoot.label')}
|
||||
</Button>
|
||||
</Tabs.Panel>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ export const CommonHead = () => {
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<link rel="shortcut icon" href="/imgs/favicon/favicon.svg" />
|
||||
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<link crossorigin="use-credentials" rel="manifest" href="/site.webmanifest" />
|
||||
|
||||
{/* configure apple splash screen & touch icon */}
|
||||
<link rel="apple-touch-icon" href="/imgs/favicon/favicon.svg" />
|
||||
|
||||
@@ -36,6 +36,20 @@ export const weatherRouter = createTRPCRouter({
|
||||
})
|
||||
)
|
||||
.query(async ({ input }) => fetchCity(input.query)),
|
||||
at: publicProcedure
|
||||
.input(
|
||||
z.object({
|
||||
longitude: z.number(),
|
||||
latitude: z.number(),
|
||||
})
|
||||
)
|
||||
.output(weatherSchema)
|
||||
.query(async ({ input }) => {
|
||||
const res = await fetch(
|
||||
`https://api.open-meteo.com/v1/forecast?latitude=${input.latitude}&longitude=${input.longitude}&daily=weathercode,temperature_2m_max,temperature_2m_min¤t_weather=true&timezone=Europe%2FLondon`
|
||||
);
|
||||
return res.json();
|
||||
}),
|
||||
});
|
||||
|
||||
export type City = z.infer<typeof citySchema>;
|
||||
|
||||
@@ -151,13 +151,23 @@ export const languages = [
|
||||
country: 'VN',
|
||||
locale: 'vi',
|
||||
},
|
||||
// Chinese (Simplified)
|
||||
{
|
||||
shortName: 'zh',
|
||||
shortName: 'cn',
|
||||
originalName: '中文',
|
||||
translatedName: 'Chinese',
|
||||
translatedName: 'Chinese (Simplified)',
|
||||
country: 'CN',
|
||||
locale: 'zh-cn',
|
||||
},
|
||||
// Chinese (Traditional)
|
||||
{
|
||||
shortName: 'tw',
|
||||
originalName: '中文(台灣)',
|
||||
translatedName: 'Chinese (Traditional)',
|
||||
emoji: '🇹🇼',
|
||||
country: 'TW',
|
||||
locale: 'zh-tw',
|
||||
},
|
||||
{
|
||||
originalName: 'Ελληνικά',
|
||||
translatedName: 'Greek',
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
IconCloudRain,
|
||||
IconMapPin,
|
||||
} from '@tabler/icons-react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { api } from '~/utils/api';
|
||||
|
||||
import { defineWidget } from '../helper';
|
||||
import { IWidget } from '../widgets';
|
||||
@@ -50,23 +50,7 @@ interface WeatherTileProps {
|
||||
}
|
||||
|
||||
function WeatherTile({ widget }: WeatherTileProps) {
|
||||
const {
|
||||
data: weather,
|
||||
isLoading,
|
||||
isError,
|
||||
} = useQuery(
|
||||
['weather', widget.properties.location],
|
||||
async () =>
|
||||
await fetch(
|
||||
`https://api.open-meteo.com/v1/forecast?latitude=${widget.properties.location.latitude}&longitude=${widget.properties.location.longitude}&daily=weathercode,temperature_2m_max,temperature_2m_min¤t_weather=true&timezone=Europe%2FLondon`,
|
||||
{
|
||||
// 15 minutes of cache
|
||||
cache: 'force-cache',
|
||||
headers: { 'Cache-Control': 'max-age=900' },
|
||||
}
|
||||
).then((res) => res.json()),
|
||||
{}
|
||||
);
|
||||
const { data: weather, isLoading, isError } = api.weather.at.useQuery(widget.properties.location);
|
||||
const { width, ref } = useElementSize();
|
||||
const { t } = useTranslation('modules/weather');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user