mirror of
https://github.com/multipleof4/GitRight.git
synced 2026-02-04 19:07:57 +00:00
Fix: Clean header, fix breadcrumb icons, remove file prompt
This commit is contained in:
40
index.html
40
index.html
@@ -29,6 +29,15 @@
|
|||||||
currentPath: '',
|
currentPath: '',
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this.$watch('currentPath', () => this.refreshIcons());
|
||||||
|
this.$watch('fileTree', () => this.refreshIcons());
|
||||||
|
},
|
||||||
|
|
||||||
|
refreshIcons() {
|
||||||
|
this.$nextTick(() => lucide.createIcons());
|
||||||
|
},
|
||||||
|
|
||||||
async selectRepo(repoStr) {
|
async selectRepo(repoStr) {
|
||||||
this.currentRepo = repoStr;
|
this.currentRepo = repoStr;
|
||||||
this.currentPath = '';
|
this.currentPath = '';
|
||||||
@@ -48,11 +57,11 @@
|
|||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
this.fileTree = data.tree || [];
|
this.fileTree = data.tree || [];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert('Error fetching repository, Meowster. Check your PAT or repo name.');
|
alert('Error fetching repository, Meowster.');
|
||||||
this.currentRepo = null;
|
this.currentRepo = null;
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.$nextTick(() => lucide.createIcons());
|
this.refreshIcons();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -73,14 +82,16 @@
|
|||||||
return this.currentPath.split('/');
|
return this.currentPath.split('/');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get repoDisplayName() {
|
||||||
|
if (!this.currentRepo) return '';
|
||||||
|
return this.currentRepo.split('@')[0].split('/').pop();
|
||||||
|
},
|
||||||
|
|
||||||
navigateTo(path) {
|
navigateTo(path) {
|
||||||
const item = this.fileTree.find(i => i.path === path);
|
const item = this.fileTree.find(i => i.path === path);
|
||||||
if (item && item.type === 'tree') {
|
if (item && item.type === 'tree') {
|
||||||
this.currentPath = path;
|
this.currentPath = path;
|
||||||
} else if (item && item.type === 'blob') {
|
|
||||||
alert('Opening file: ' + path + ', Master.');
|
|
||||||
}
|
}
|
||||||
this.$nextTick(() => lucide.createIcons());
|
|
||||||
},
|
},
|
||||||
|
|
||||||
goUp() {
|
goUp() {
|
||||||
@@ -88,7 +99,6 @@
|
|||||||
const parts = this.currentPath.split('/');
|
const parts = this.currentPath.split('/');
|
||||||
parts.pop();
|
parts.pop();
|
||||||
this.currentPath = parts.join('/');
|
this.currentPath = parts.join('/');
|
||||||
this.$nextTick(() => lucide.createIcons());
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addRepo() {
|
addRepo() {
|
||||||
@@ -96,9 +106,7 @@
|
|||||||
if (repo && repo.includes('/')) {
|
if (repo && repo.includes('/')) {
|
||||||
this.repos.push(repo);
|
this.repos.push(repo);
|
||||||
this.saveRepos();
|
this.saveRepos();
|
||||||
this.$nextTick(() => lucide.createIcons());
|
this.refreshIcons();
|
||||||
} else if (repo) {
|
|
||||||
alert('Invalid format, Meowster.');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -114,18 +122,9 @@
|
|||||||
|
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<header class="flex items-center justify-between px-4 py-2 border-b border-gray-100 bg-white z-50 shrink-0">
|
<header class="flex items-center justify-between px-4 py-2 border-b border-gray-100 bg-white z-50 shrink-0">
|
||||||
<div class="flex items-center space-x-2">
|
|
||||||
<button @click="leftSidebar = !leftSidebar" class="p-1.5 hover:bg-gray-50 rounded-md border border-gray-200 text-slate-600">
|
<button @click="leftSidebar = !leftSidebar" class="p-1.5 hover:bg-gray-50 rounded-md border border-gray-200 text-slate-600">
|
||||||
<i data-lucide="panel-left" class="w-4 h-4"></i>
|
<i data-lucide="panel-left" class="w-4 h-4"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="h-4 w-[1px] bg-gray-200 mx-1"></div>
|
|
||||||
<template x-if="currentRepo">
|
|
||||||
<div class="flex items-center text-xs font-medium text-slate-500 truncate max-w-[150px]">
|
|
||||||
<i data-lucide="github" class="w-3 h-3 mr-1.5"></i>
|
|
||||||
<span x-text="currentRepo.split('@')[0]"></span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bg-slate-100 p-1.5 rounded-full">
|
<div class="bg-slate-100 p-1.5 rounded-full">
|
||||||
<i data-lucide="sun" class="w-4 h-4 text-slate-600"></i>
|
<i data-lucide="sun" class="w-4 h-4 text-slate-600"></i>
|
||||||
@@ -145,7 +144,7 @@
|
|||||||
<i data-lucide="arrow-up" class="w-4 h-4 text-slate-600"></i>
|
<i data-lucide="arrow-up" class="w-4 h-4 text-slate-600"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="flex-1 flex items-center bg-slate-50 border border-slate-200 rounded px-2 py-1 overflow-x-auto custom-scrollbar">
|
<div class="flex-1 flex items-center bg-slate-50 border border-slate-200 rounded px-2 py-1 overflow-x-auto custom-scrollbar">
|
||||||
<button @click="currentPath = ''" class="text-xs text-blue-600 hover:underline whitespace-nowrap">root</button>
|
<button @click="currentPath = ''" class="text-xs font-bold text-blue-600 hover:underline whitespace-nowrap" x-text="repoDisplayName"></button>
|
||||||
<template x-for="(part, index) in breadcrumbs" :key="index">
|
<template x-for="(part, index) in breadcrumbs" :key="index">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<i data-lucide="chevron-right" class="w-3 h-3 mx-1 text-slate-400"></i>
|
<i data-lucide="chevron-right" class="w-3 h-3 mx-1 text-slate-400"></i>
|
||||||
@@ -309,9 +308,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
lucide.createIcons();
|
lucide.createIcons();
|
||||||
document.addEventListener('alpine:initialized', () => {
|
|
||||||
lucide.createIcons();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user