mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-18 18:49:50 +00:00
add global settings context
will be useful going forward, and simplify widget props being passed around all over the place
This commit is contained in:
parent
244a76de0b
commit
a677fbefbf
9 changed files with 57 additions and 28 deletions
|
@ -1,10 +1,13 @@
|
|||
import Image from "next/future/image";
|
||||
import { useContext } from "react";
|
||||
import { Disclosure } from "@headlessui/react";
|
||||
|
||||
import Status from "./status";
|
||||
import Widget from "./widget";
|
||||
import Docker from "./widgets/service/docker";
|
||||
|
||||
import { SettingsContext } from "utils/settings-context";
|
||||
|
||||
function resolveIcon(icon) {
|
||||
if (icon.startsWith("http")) {
|
||||
return `/api/proxy?url=${encodeURIComponent(icon)}`;
|
||||
|
@ -21,8 +24,9 @@ function resolveIcon(icon) {
|
|||
return `https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${icon}.png`;
|
||||
}
|
||||
|
||||
export default function Item({ service, target = "_blank" }) {
|
||||
export default function Item({ service }) {
|
||||
const hasLink = service.href && service.href !== "#";
|
||||
const { settings } = useContext(SettingsContext);
|
||||
|
||||
return (
|
||||
<li key={service.name}>
|
||||
|
@ -37,7 +41,7 @@ export default function Item({ service, target = "_blank" }) {
|
|||
(hasLink ? (
|
||||
<a
|
||||
href={service.href}
|
||||
target={target}
|
||||
target={settings.target ?? "_blank"}
|
||||
rel="noreferrer"
|
||||
className="flex-shrink-0 flex items-center justify-center w-12 "
|
||||
>
|
||||
|
@ -52,7 +56,7 @@ export default function Item({ service, target = "_blank" }) {
|
|||
{hasLink ? (
|
||||
<a
|
||||
href={service.href}
|
||||
target={target}
|
||||
target={settings.target ?? "_blank"}
|
||||
rel="noreferrer"
|
||||
className="flex-1 flex items-center justify-between rounded-r-md "
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue