mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-08 06:38:46 +00:00
linting and cleanup
This commit is contained in:
parent
7f041e8303
commit
f74e8b9d32
51 changed files with 464 additions and 349 deletions
|
@ -1,7 +1,7 @@
|
|||
import mapIcon from "utils/owm-condition-map";
|
||||
|
||||
export default function Icon({ condition, timeOfDay }) {
|
||||
const Icon = mapIcon(condition, timeOfDay);
|
||||
const IconComponent = mapIcon(condition, timeOfDay);
|
||||
|
||||
return <Icon className="w-10 h-10 text-theme-800 dark:text-theme-200"></Icon>;
|
||||
return <IconComponent className="w-10 h-10 text-theme-800 dark:text-theme-200" />;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import Icon from "./icon";
|
|||
export default function OpenWeatherMap({ options }) {
|
||||
const { data, error } = useSWR(`/api/widgets/openweathermap?${new URLSearchParams(options).toString()}`);
|
||||
|
||||
if (error || data?.cod == 401) {
|
||||
if (error || data?.cod === 401) {
|
||||
return (
|
||||
<div className="flex flex-col">
|
||||
<div className="flex flex-row items-center justify-end">
|
||||
|
@ -23,11 +23,11 @@ export default function OpenWeatherMap({ options }) {
|
|||
}
|
||||
|
||||
if (!data) {
|
||||
return <div className="flex flex-row items-center"></div>;
|
||||
return <div className="flex flex-row items-center" />;
|
||||
}
|
||||
|
||||
if (data.error) {
|
||||
return <div className="flex flex-row items-center"></div>;
|
||||
return <div className="flex flex-row items-center" />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import useSWR from "swr";
|
||||
import { FiHardDrive } from "react-icons/fi";
|
||||
import { BiError } from "react-icons/bi";
|
||||
|
||||
import { formatBytes } from "utils/stats-helpers";
|
||||
|
||||
export default function Disk({ options }) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import useSWR from "swr";
|
||||
import { FaMemory } from "react-icons/fa";
|
||||
import { BiError } from "react-icons/bi";
|
||||
|
||||
import { formatBytes } from "utils/stats-helpers";
|
||||
|
||||
export default function Memory() {
|
||||
|
|
|
@ -4,19 +4,17 @@ import Memory from "./memory";
|
|||
|
||||
export default function Resources({ options }) {
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col max-w:full basis-1/2 sm:basis-auto self-center">
|
||||
<div className="flex flex-row space-x-4 self-center">
|
||||
{options.cpu && <Cpu />}
|
||||
{options.memory && <Memory />}
|
||||
{options.disk && <Disk options={options} />}
|
||||
</div>
|
||||
{options.label && (
|
||||
<div className="border-t-2 border-theme-800 dark:border-theme-200 mt-1 pt-1 text-center text-theme-800 dark:text-theme-200 text-xs">
|
||||
{options.label}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex flex-col max-w:full basis-1/2 sm:basis-auto self-center">
|
||||
<div className="flex flex-row space-x-4 self-center">
|
||||
{options.cpu && <Cpu />}
|
||||
{options.memory && <Memory />}
|
||||
{options.disk && <Disk options={options} />}
|
||||
</div>
|
||||
</>
|
||||
{options.label && (
|
||||
<div className="border-t-2 border-theme-800 dark:border-theme-200 mt-1 pt-1 text-center text-theme-800 dark:text-theme-200 text-xs">
|
||||
{options.label}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ export default function Search({ options }) {
|
|||
const [query, setQuery] = useState("");
|
||||
|
||||
if (!provider) {
|
||||
return <></>;
|
||||
return null;
|
||||
}
|
||||
|
||||
function handleSubmit(event) {
|
||||
|
@ -49,11 +49,10 @@ export default function Search({ options }) {
|
|||
|
||||
return (
|
||||
<form className="flex-col relative h-8 my-4 min-w-full md:min-w-fit grow" onSubmit={handleSubmit}>
|
||||
<div className="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none w-full text-theme-800 dark:text-theme-200"></div>
|
||||
<div className="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none w-full text-theme-800 dark:text-theme-200" />
|
||||
<input
|
||||
type="search"
|
||||
autoFocus
|
||||
className={`overflow-hidden w-full placeholder-theme-900 text-xs text-theme-900 bg-theme-50 rounded-md border border-theme-300 focus:ring-theme-500 focus:border-theme-500 dark:bg-theme-800 dark:border-theme-600 dark:placeholder-theme-400 dark:text-white dark:focus:ring-theme-500 dark:focus:border-theme-500 h-full`}
|
||||
className="overflow-hidden w-full placeholder-theme-900 text-xs text-theme-900 bg-theme-50 rounded-md border border-theme-300 focus:ring-theme-500 focus:border-theme-500 dark:bg-theme-800 dark:border-theme-600 dark:placeholder-theme-400 dark:text-white dark:focus:ring-theme-500 dark:focus:border-theme-500 h-full"
|
||||
placeholder="Search..."
|
||||
onChange={(s) => setQuery(s.currentTarget.value)}
|
||||
required
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import mapIcon from "utils/condition-map";
|
||||
|
||||
export default function Icon({ condition, timeOfDay }) {
|
||||
const Icon = mapIcon(condition, timeOfDay);
|
||||
const IconComponent = mapIcon(condition, timeOfDay);
|
||||
|
||||
return <Icon className="w-10 h-10 text-theme-800 dark:text-theme-200"></Icon>;
|
||||
return <IconComponent className="w-10 h-10 text-theme-800 dark:text-theme-200" />;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import { BiError } from "react-icons/bi";
|
|||
import Icon from "./icon";
|
||||
|
||||
export default function WeatherApi({ options }) {
|
||||
console.log(options);
|
||||
const { data, error } = useSWR(`/api/widgets/weather?${new URLSearchParams(options).toString()}`);
|
||||
|
||||
if (error) {
|
||||
|
@ -24,11 +23,11 @@ export default function WeatherApi({ options }) {
|
|||
}
|
||||
|
||||
if (!data) {
|
||||
return <div className="flex flex-row items-center justify-end"></div>;
|
||||
return <div className="flex flex-row items-center justify-end" />;
|
||||
}
|
||||
|
||||
if (data.error) {
|
||||
return <div className="flex flex-row items-center justify-end"></div>;
|
||||
return <div className="flex flex-row items-center justify-end" />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue