Skip to content

Commit

Permalink
fix: top-level await
Browse files Browse the repository at this point in the history
  • Loading branch information
quertc committed Jan 31, 2023
1 parent d3764f7 commit 259306d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/components/Logs.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { useRef, useEffect } from 'react';
import { Card, Divider, Text } from '@mantine/core';
import { useLogs } from '../hooks/useLogs';
import Log from './Log';

function Logs() {
const { logs, isError } = useLogs();
const cardRef = React.useRef<HTMLDivElement>(null);
const bottomRef = React.useRef<HTMLDivElement>(null);
const cardRef = useRef<HTMLDivElement>(null);
const bottomRef = useRef<HTMLDivElement>(null);

const scrollToBottom = () => {
if (cardRef.current && bottomRef.current) {
Expand All @@ -17,7 +17,7 @@ function Logs() {
}
};

React.useEffect(() => {
useEffect(() => {
scrollToBottom();
}, [logs]);

Expand Down
8 changes: 2 additions & 6 deletions src/components/Shell.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { useMantineColorScheme, AppShell, Header, Group, Button, ActionIcon } from '@mantine/core';
import { IconBrandGithub, IconSun, IconMoonStars } from '@tabler/icons-react';
import { getName, getVersion } from '@tauri-apps/api/app';
import PackageJson from '../../package.json';
import DarkBg from '../images/dark-bg.jpg';
import LightBg from '../images/light-bg.jpg';

const appName = await getName();
const appVersion = await getVersion();

interface ShellProps {
children: React.ReactNode;
}

function Shell({ children }: ShellProps) {
const colorSchemeContext = useMantineColorScheme();
const appName = `${PackageJson.name} v${PackageJson.version}`;

return (
<AppShell
Expand All @@ -22,8 +20,6 @@ function Shell({ children }: ShellProps) {
<Group sx={{ height: '100%' }} px={20} position="apart">
<Button component="a" href="https://github.com/" target="_blank" variant="default" leftIcon={<IconBrandGithub size={18} />}>
{appName}
{' v'}
{appVersion}
</Button>
<ActionIcon
onClick={() => colorSchemeContext.toggleColorScheme()}
Expand Down

0 comments on commit 259306d

Please sign in to comment.