mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
fix(ui): label non-GitHub git sources as Remote instead of Local
SourceBadge only recognised github/github-subdir metadata types, so skills installed from Gitea, GitLab, self-hosted or SSH git sources fell through to the Local badge. Add a Remote badge for any non-local install source, matching the CLI list view. Refs #270
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Badge from './Badge';
|
||||
|
||||
type SourceType = 'tracked' | 'github' | 'local';
|
||||
type SourceType = 'tracked' | 'github' | 'remote' | 'local';
|
||||
|
||||
interface SourceBadgeProps {
|
||||
type?: string;
|
||||
@@ -8,15 +8,19 @@ interface SourceBadgeProps {
|
||||
size?: 'sm' | 'md';
|
||||
}
|
||||
|
||||
// Metadata `type` values: github, github-subdir, git-https, git-ssh
|
||||
// (optionally -subdir), local, or empty for skills with no install source.
|
||||
function resolveSource(type?: string, isInRepo?: boolean): SourceType {
|
||||
if (isInRepo) return 'tracked';
|
||||
if (type === 'github' || type === 'github-subdir') return 'github';
|
||||
if (type?.startsWith('github')) return 'github';
|
||||
if (type && !type.startsWith('local')) return 'remote';
|
||||
return 'local';
|
||||
}
|
||||
|
||||
const config: Record<SourceType, { label: string; variant: 'default' | 'info' }> = {
|
||||
tracked: { label: 'Tracked', variant: 'default' },
|
||||
github: { label: 'GitHub', variant: 'info' },
|
||||
remote: { label: 'Remote', variant: 'info' },
|
||||
local: { label: 'Local', variant: 'default' },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user