Skip to content

Commit

Permalink
style: Update import statements to use single quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
pacholoamit committed Oct 14, 2024
1 parent 9ba2e08 commit 3820da9
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 52 deletions.
5 changes: 5 additions & 0 deletions src-tauri/capabilities/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"store:allow-get",
"store:allow-set",
"store:allow-save",
"store:default",
"store:allow-create-store",
"store:allow-clear",
"store:allow-delete",
"store:allow-entries",
"os:default",
"os:allow-arch",
"os:allow-hostname",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/gen/schemas/capabilities.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"main":{"identifier":"main","description":"permissions for pachtop","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","os:default","os:allow-arch","os:allow-hostname","os:allow-exe-extension","os:allow-family","os:allow-os-type","os:allow-platform","os:allow-version","core:window:allow-start-dragging","autostart:allow-enable","autostart:allow-disable","autostart:allow-is-enabled","updater:allow-check","updater:default","log:allow-log","log:default","shell:allow-spawn","core:menu:allow-new","core:menu:allow-popup","core:window:allow-close","core:window:allow-center","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-set-size","core:window:allow-set-focus","core:window:allow-is-maximized","core:window:allow-start-dragging","core:window:allow-toggle-maximize","decorum:allow-show-snap-overlay",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"powershell","name":"powershell"}]},"fs:read-all","fs:read-files","fs:read-meta"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default"]}}
{"main":{"identifier":"main","description":"permissions for pachtop","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:default","store:allow-create-store","store:allow-clear","store:allow-delete","store:allow-entries","os:default","os:allow-arch","os:allow-hostname","os:allow-exe-extension","os:allow-family","os:allow-os-type","os:allow-platform","os:allow-version","core:window:allow-start-dragging","autostart:allow-enable","autostart:allow-disable","autostart:allow-is-enabled","updater:allow-check","updater:default","log:allow-log","log:default","shell:allow-spawn","core:menu:allow-new","core:menu:allow-popup","core:window:allow-close","core:window:allow-center","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-set-size","core:window:allow-set-focus","core:window:allow-is-maximized","core:window:allow-start-dragging","core:window:allow-toggle-maximize","decorum:allow-show-snap-overlay",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"powershell","name":"powershell"}]},"fs:read-all","fs:read-files","fs:read-meta"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default"]}}
19 changes: 11 additions & 8 deletions src/components/area-chart.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import HighchartsReact from "highcharts-react-official";
import * as Highcharts from "highcharts/highstock";
import HighchartsBoost from "highcharts/modules/boost";
import { Dispatch, SetStateAction, useEffect, useRef, useState } from "react";
import HighchartsReact from 'highcharts-react-official';
import * as Highcharts from 'highcharts/highstock';
import HighchartsBoost from 'highcharts/modules/boost';
import { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react';

import useSettings from "@/hooks/useSettings";
import { useMantineTheme } from "@mantine/core";
import { useViewportSize } from "@mantine/hooks";
import useSettings from '@/hooks/useSettings';
import { useMantineTheme } from '@mantine/core';
import { useViewportSize } from '@mantine/hooks';

HighchartsBoost(Highcharts);

Expand Down Expand Up @@ -101,7 +101,7 @@ export const useAreaChartState = (
title: {
text: null,
},

startOnTick: true,
endOnTick: true,

gridLineColor: other.charts.area.default.gridLineColor,
Expand Down Expand Up @@ -191,6 +191,9 @@ export const useAreaChartState = (
alignTicks: false,
backgroundColor: "transparent",
animation: settings.isPerformanceModeEnabled ? false : true,
zooming: {
mouseWheel: true,
},
},
});

Expand Down
104 changes: 65 additions & 39 deletions src/features/metrics/pages/dashboard.page.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
import { useShallow } from "zustand/react/shallow";
import { useShallow } from 'zustand/react/shallow';

import PageWrapper from "@/components/page-wrapper";
import SystemInformationWidget from "@/components/system-information-widget";
import CpusBarChart from "@/features/metrics/components/cpus/cpus.bar-charts";
import DiskAreaChart from "@/features/metrics/components/disks/disk.area-chart";
import DiskStatsRing from "@/features/metrics/components/disks/disk.stats-ring";
import GlobalCpuAreaChart from "@/features/metrics/components/global-cpu/global-cpu.area-chart";
import GlobalCpuStatsRing from "@/features/metrics/components/global-cpu/global-cpu.stats-ring";
import MemoryAreaChart from "@/features/metrics/components/memory/memory.area-chart";
import MemoryStatsRing from "@/features/metrics/components/memory/memory.stats-ring";
import NetworksReceivedAreaChart from "@/features/metrics/components/networks/networks-received.area-chart";
import NetworksTransmittedAreaChart from "@/features/metrics/components/networks/networks-transmitted.area-chart";
import SwapAreaChart from "@/features/metrics/components/swap/swap.area-chart";
import SwapStatsRing from "@/features/metrics/components/swap/swap.stats-ring";
import useDisksSelectors from "@/features/metrics/stores/disk.store";
import useSystemStoreSelectors from "@/features/metrics/stores/system.store";
import useRandomGreeting from "@/hooks/useRandomGreeting";
import { Grid } from "@mantine/core";
import PageWrapper from '@/components/page-wrapper';
import SystemInformationWidget from '@/components/system-information-widget';
import CpusBarChart from '@/features/metrics/components/cpus/cpus.bar-charts';
import DiskAreaChart from '@/features/metrics/components/disks/disk.area-chart';
import DiskStatsRing from '@/features/metrics/components/disks/disk.stats-ring';
import GlobalCpuAreaChart from '@/features/metrics/components/global-cpu/global-cpu.area-chart';
import GlobalCpuStatsRing from '@/features/metrics/components/global-cpu/global-cpu.stats-ring';
import MemoryAreaChart from '@/features/metrics/components/memory/memory.area-chart';
import MemoryStatsRing from '@/features/metrics/components/memory/memory.stats-ring';
import NetworksReceivedAreaChart from '@/features/metrics/components/networks/networks-received.area-chart';
import NetworksTransmittedAreaChart from '@/features/metrics/components/networks/networks-transmitted.area-chart';
import SwapAreaChart from '@/features/metrics/components/swap/swap.area-chart';
import SwapStatsRing from '@/features/metrics/components/swap/swap.stats-ring';
import useDisksSelectors from '@/features/metrics/stores/disk.store';
import useSystemStoreSelectors from '@/features/metrics/stores/system.store';
import useRandomGreeting from '@/hooks/useRandomGreeting';
import { Divider, Grid, Text } from '@mantine/core';

const StatsRings = () => {
return (
<>
<Grid.Col sm={6} md={6} lg={3} xl={3}>
<GlobalCpuStatsRing />
</Grid.Col>
<Grid.Col sm={6} md={6} lg={3} xl={3}>
<MemoryStatsRing />
</Grid.Col>
<Grid.Col sm={6} md={6} lg={3} xl={3}>
<SwapStatsRing />
</Grid.Col>
<Grid.Col sm={6} md={6} lg={3} xl={3}>
<DiskStatsRing />
</Grid.Col>
</>
);
};
// const StatsRings = () => {
// return (
// <>
// <Grid.Col sm={6} md={6} lg={3} xl={3}>
// <GlobalCpuStatsRing />
// </Grid.Col>
// <Grid.Col sm={6} md={6} lg={3} xl={3}>
// <MemoryStatsRing />
// </Grid.Col>
// <Grid.Col sm={6} md={6} lg={3} xl={3}>
// <SwapStatsRing />
// </Grid.Col>
// <Grid.Col sm={6} md={6} lg={3} xl={3}>
// <DiskStatsRing />
// </Grid.Col>
// </>
// );
// };

const MemorySection = () => {
return (
<>
<Grid.Col md={6} sm={12}>
<MemoryAreaChart />
</Grid.Col>
<Grid.Col md={6} sm={12}>
<SwapAreaChart />
</Grid.Col>
Expand All @@ -54,8 +57,7 @@ const CpuSection = () => {
<GlobalCpuAreaChart />
</Grid.Col>
<Grid.Col md={6} sm={12}>
{/* <CpusBarChart /> */}
<MemoryAreaChart />
<CpusBarChart />
</Grid.Col>
</>
);
Expand Down Expand Up @@ -88,6 +90,28 @@ const DiskSection = () => {
);
};

interface DashboardSectionsDividerProps {
label: string;
}
const DashboardSectionsDivider = ({ label }: DashboardSectionsDividerProps) => {
return (
<>
<Grid.Col span={12}>
<Divider
my="xs"
label={
<>
<Text c="dimmed" size="sm" tt="uppercase" weight={700}>
{label}
</Text>
</>
}
/>
</Grid.Col>
</>
);
};

const DashboardPage = () => {
const hostname = useSystemStoreSelectors(useShallow((state) => state.info.hostname));
const greeting = useRandomGreeting(hostname);
Expand All @@ -97,10 +121,12 @@ const DashboardPage = () => {
<Grid.Col span={12}>
<SystemInformationWidget />
</Grid.Col>
{/* <StatsRings /> */}
<DashboardSectionsDivider label="General" />
<CpuSection />
<MemorySection />
<DashboardSectionsDivider label="Disks" />
<DiskSection />
<DashboardSectionsDivider label="Networks" />
<NetworksSection />
</Grid>
</PageWrapper>
Expand Down
9 changes: 5 additions & 4 deletions src/lib/store.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Store } from "tauri-plugin-store";
import { Store } from 'tauri-plugin-store';

import logger from "@/lib/logger";
import { appDataDir } from "@tauri-apps/api/path";
import { platform } from "@tauri-apps/plugin-os";
import logger from '@/lib/logger';
import { appDataDir } from '@tauri-apps/api/path';

const { platform } = window.__TAURI__.os;

// Generic function to create get/set operations
const createStoreItem = <T>(store: Store, key: string, defaultValue: T) => ({
Expand Down

0 comments on commit 3820da9

Please sign in to comment.