git stack source badge with forge-aware icons and commit hash
This commit is contained in:
9 files changed
+280
-76
No files matched your search
@@ -0,0 +1,10 @@
|
||||
<script lang="ts">
|
||||
// Generic git-repository glyph (non-GitHub/GitLab forge). The official Git
|
||||
// logo (mdi-git) - distinct from lucide's GitBranch, which reads as a branch.
|
||||
// currentColor so it inherits text color; `class` mirrors the lucide icon API.
|
||||
let { class: className = '' }: { class?: string } = $props();
|
||||
</script>
|
||||
|
||||
<svg class={className} viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
<path d="M2.6,10.59L8.38,4.8L10.07,6.5C9.83,7.35 10.22,8.28 11,8.73V14.27C10.4,14.61 10,15.26 10,16A2,2 0 0,0 12,18A2,2 0 0,0 14,16C14,15.26 13.6,14.61 13,14.27V9.41L15.07,11.5C15,11.65 15,11.82 15,12A2,2 0 0,0 17,14A2,2 0 0,0 19,12A2,2 0 0,0 17,10C16.82,10 16.65,10 16.5,10.07L13.93,7.5C14.19,6.57 13.71,5.55 12.78,5.16C12.35,5 11.9,4.96 11.5,5.07L9.8,3.38L10.59,2.6C11.37,1.81 12.63,1.81 13.41,2.6L21.4,10.59C22.19,11.37 22.19,12.63 21.4,13.41L13.41,21.4C12.63,22.19 11.37,22.19 10.59,21.4L2.6,13.41C1.81,12.63 1.81,11.37 2.6,10.59Z" />
|
||||
</svg>
|
||||
@@ -17,6 +17,7 @@ export interface AppSettings {
|
||||
confirmDestructive: boolean;
|
||||
showStoppedContainers: boolean;
|
||||
highlightUpdates: boolean;
|
||||
showGitCommitHash: boolean;
|
||||
timeFormat: TimeFormat;
|
||||
dateFormat: DateFormat;
|
||||
downloadFormat: DownloadFormat;
|
||||
@@ -59,6 +60,7 @@ const DEFAULT_SETTINGS: AppSettings = {
|
||||
confirmDestructive: true,
|
||||
showStoppedContainers: true,
|
||||
highlightUpdates: true,
|
||||
showGitCommitHash: false,
|
||||
timeFormat: '24h',
|
||||
dateFormat: 'DD.MM.YYYY',
|
||||
downloadFormat: 'tar',
|
||||
@@ -147,6 +149,7 @@ function createSettingsStore() {
|
||||
confirmDestructive: settings.confirmDestructive ?? DEFAULT_SETTINGS.confirmDestructive,
|
||||
showStoppedContainers: settings.showStoppedContainers ?? DEFAULT_SETTINGS.showStoppedContainers,
|
||||
highlightUpdates: settings.highlightUpdates ?? DEFAULT_SETTINGS.highlightUpdates,
|
||||
showGitCommitHash: settings.showGitCommitHash ?? DEFAULT_SETTINGS.showGitCommitHash,
|
||||
timeFormat: settings.timeFormat ?? DEFAULT_SETTINGS.timeFormat,
|
||||
dateFormat: settings.dateFormat ?? DEFAULT_SETTINGS.dateFormat,
|
||||
downloadFormat: settings.downloadFormat ?? DEFAULT_SETTINGS.downloadFormat,
|
||||
@@ -205,6 +208,7 @@ function createSettingsStore() {
|
||||
confirmDestructive: updatedSettings.confirmDestructive ?? DEFAULT_SETTINGS.confirmDestructive,
|
||||
showStoppedContainers: updatedSettings.showStoppedContainers ?? DEFAULT_SETTINGS.showStoppedContainers,
|
||||
highlightUpdates: updatedSettings.highlightUpdates ?? DEFAULT_SETTINGS.highlightUpdates,
|
||||
showGitCommitHash: updatedSettings.showGitCommitHash ?? DEFAULT_SETTINGS.showGitCommitHash,
|
||||
timeFormat: updatedSettings.timeFormat ?? DEFAULT_SETTINGS.timeFormat,
|
||||
dateFormat: updatedSettings.dateFormat ?? DEFAULT_SETTINGS.dateFormat,
|
||||
downloadFormat: updatedSettings.downloadFormat ?? DEFAULT_SETTINGS.downloadFormat,
|
||||
@@ -287,6 +291,13 @@ function createSettingsStore() {
|
||||
return newSettings;
|
||||
});
|
||||
},
|
||||
setShowGitCommitHash: (value: boolean) => {
|
||||
update((current) => {
|
||||
const newSettings = { ...current, showGitCommitHash: value };
|
||||
saveSettings({ showGitCommitHash: value });
|
||||
return newSettings;
|
||||
});
|
||||
},
|
||||
setTimeFormat: (value: TimeFormat) => {
|
||||
update((current) => {
|
||||
const newSettings = { ...current, timeFormat: value };
|
||||
@@ -626,6 +637,15 @@ export function formatDate(date: Date | string | number): string {
|
||||
return formatDatePart(d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compact relative time like "just now", "5m ago", "2d ago", "3mo ago".
|
||||
* For display ONLY, alongside the absolute date - sort still uses the raw
|
||||
* timestamp, never this string.
|
||||
*/
|
||||
// Re-exported from the import-light utils/format module (so it stays unit-testable
|
||||
// without pulling $app/environment). Kept exported here for existing callers.
|
||||
export { formatRelativeTime } from '$lib/utils/format';
|
||||
|
||||
/**
|
||||
* Get the current time format setting (for components that need it).
|
||||
*/
|
||||
@@ -640,6 +660,14 @@ export function getDateFormat(): DateFormat {
|
||||
return cachedDateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the global default timezone setting (for components that format a time and have
|
||||
* no more-specific timezone to use). Falls back to UTC via DEFAULT_SETTINGS.
|
||||
*/
|
||||
export function getDefaultTimezone(): string {
|
||||
return cachedDefaultTimezone;
|
||||
}
|
||||
|
||||
// Regex matching ISO 8601 timestamps at the start of log lines (after optional container prefix)
|
||||
// Matches: 2026-01-12T07:47:44.449821093Z or 2026-01-12T07:47:44Z
|
||||
const ISO_TIMESTAMP_RE = /(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.\d+)?Z/g;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Github, Gitlab } from 'lucide-svelte';
|
||||
import type { Component } from 'svelte';
|
||||
import GitGenericIcon from '$lib/components/icons/GitGenericIcon.svelte';
|
||||
|
||||
/**
|
||||
* Pick a forge icon from a repo URL: GitHub and GitLab get their own mark,
|
||||
* everything else gets the generic Git logo (mdi-git, not lucide's GitBranch
|
||||
* which reads as a branch).
|
||||
*/
|
||||
export function forgeIcon(url: string | null | undefined): Component {
|
||||
const u = (url || '').toLowerCase();
|
||||
if (u.includes('github.com')) return Github as unknown as Component;
|
||||
if (u.includes('gitlab.')) return Gitlab as unknown as Component;
|
||||
return GitGenericIcon as unknown as Component;
|
||||
}
|
||||
Reference in new issue
Block a user