Skip to content

Commit

Permalink
feat: update icon & add manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKetmo committed Nov 15, 2024
1 parent b9eeab7 commit 84fa0ee
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 0 deletions.
Binary file added public/app-icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/web-app-manifest-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/web-app-manifest-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/app/favicon.ico
Binary file not shown.
8 changes: 8 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ const geistMono = localFont({
export const metadata: Metadata = {
title: "Radar",
description: "Dashboard for AlertManager Prometheus",
icons: [
{ rel: "shortcut icon", type: "image/x-icon", url: "/favicon.ico", },
{ rel: "icon", type: "image/png", sizes: "96x96", url: "/favicon-96x96.png", },
{ rel: "icon", type: "image/png", sizes: "192x192", url: "/web-app-manifest-192x192.png", },
{ rel: "icon", type: "image/png", sizes: "512x512", url: "/web-app-manifest-512x512.png", },
{ rel: "icon", type: "image/svg+xml", sizes: "96x96", url: "/favicon.svg", },
{ rel: "apple-touch-icon", sizes: "180x180", url: "/apple-touch-icon.png", },
],
};

export default async function RootLayout({
Expand Down
18 changes: 18 additions & 0 deletions src/app/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { MetadataRoute } from 'next'

export default async function manifest(): Promise<MetadataRoute.Manifest> {
return {
name: 'Radar',
short_name: 'Radar',
description: 'Dashboard for AlertManager Prometheus',
start_url: '/',
display: 'standalone',
icons: [
{
src: '/app-icon-512x512.png',
sizes: '512x512',
type: 'image/png',
}
]
}
}
2 changes: 2 additions & 0 deletions src/components/layout/app-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { SidebarProvider } from "@/components/ui/sidebar";
import { AppSidebar } from "./app-sidebar";
import { AppThemeColor } from "./app-theme-color";

export function AppLayout({ children }: { children: React.ReactNode }) {
return (
<SidebarProvider>
<AppThemeColor />
<AppSidebar />
<main className="grow relative">
<div className="absolute inset-0">
Expand Down
24 changes: 24 additions & 0 deletions src/components/layout/app-theme-color.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client'

import { useTheme } from "next-themes"
import { useEffect } from "react"

export function AppThemeColor() {
const { resolvedTheme } = useTheme()

useEffect(() => {
let themeColorMeta = document.querySelector(
'meta[name="theme-color"]',
) as HTMLMetaElement

if (!themeColorMeta) {
themeColorMeta = document.createElement('meta')
themeColorMeta.name = 'theme-color'
document.head.appendChild(themeColorMeta)
}

themeColorMeta.content = resolvedTheme === 'dark' ? '#171717' : '#EEF2F8'
}, [resolvedTheme])

return null
}

0 comments on commit 84fa0ee

Please sign in to comment.