Skip to content

Commit d32eb07

Browse files
committed
Optimize the dashboard
1 parent 550abdb commit d32eb07

File tree

7 files changed

+57
-4
lines changed

7 files changed

+57
-4
lines changed

options/locale/locale_en-US.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ licenses = Licenses
2727
return_to_gitea = Return to Gitea
2828
more_items = More items
2929

30+
guide.welcome = Welcome to the Gitea.
31+
guide.welcome_desc = Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD.
32+
3033
username = Username
3134
email = Email Address
3235
password = Password
@@ -1010,6 +1013,7 @@ visibility.private = Private
10101013
visibility.private_tooltip = Visible only to members of organizations you have joined
10111014

10121015
[repo]
1016+
empty = There are no repositories yet.
10131017
new_repo_helper = A repository contains all project files, including revision history. Already hosting one elsewhere? <a href="%s">Migrate repository.</a>
10141018
owner = Owner
10151019
owner_helper = Some organizations may not show up in the dropdown due to a maximum repository count limit.
@@ -2738,6 +2742,7 @@ contributors.what = contributions
27382742
recent_commits.what = recent commits
27392743

27402744
[org]
2745+
empty = There are no organizations yet.
27412746
org_name_holder = Organization Name
27422747
org_full_name_holder = Organization Full Name
27432748
org_name_helper = Organization names should be short and memorable.

templates/user/dashboard/dashboard.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<div class="flex-container-main">
66
{{template "base/alert" .}}
77
{{template "user/heatmap" .}}
8+
{{template "user/dashboard/guide" .}}
89
{{template "user/dashboard/feeds" .}}
910
</div>
1011
{{template "user/dashboard/repolist" .}}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{if not .Feeds}}
2+
<div class="ui center segment tw-py-8">
3+
<img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true">
4+
<h2>{{ctx.Locale.Tr "guide.welcome"}}</h2>
5+
<p>{{ctx.Locale.Tr "guide.welcome_desc"}}</p>
6+
</div>
7+
{{end}}
8+

templates/user/dashboard/repolist.tmpl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ const data = {
55
isMirrorsEnabled: {{.MirrorsEnabled}},
66
isStarsEnabled: {{not .IsDisableStars}},
77

8+
canCreateMigrations: {{not .DisableMigrations}},
9+
10+
textNoOrg: {{ctx.Locale.Tr "org.empty"}},
11+
textNoRepo: {{ctx.Locale.Tr "repo.empty"}},
812
textRepository: {{ctx.Locale.Tr "repository"}},
913
textOrganization: {{ctx.Locale.Tr "organization"}},
1014
textMyRepos: {{ctx.Locale.Tr "home.my_repos"}},
1115
textNewRepo: {{ctx.Locale.Tr "new_repo"}},
16+
textNewMigrate: {{ctx.Locale.Tr "new_migrate"}},
1217
textSearchRepos: {{ctx.Locale.Tr "search.repo_kind"}},
1318
textFilter: {{ctx.Locale.Tr "home.filter"}},
1419
textShowArchived: {{ctx.Locale.Tr "home.show_archived"}},
@@ -56,4 +61,4 @@ data.organizationId = {{.ContextUser.ID}};
5661
window.config.pageData.dashboardRepoList = data;
5762
</script>
5863

59-
<div id="dashboard-repo-list" class="flex-container-sidebar"></div>
64+
<div id="dashboard-repo-list" class="flex-container-sidebar is-loading"></div>

web_src/css/dashboard.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,7 @@
7070
.dashboard .secondary-nav .ui.dropdown {
7171
max-width: 100%;
7272
}
73+
74+
.dashboard #dashboard-repo-list.is-loading {
75+
aspect-ratio: 5.415; /* the size is about 790 x 145 */
76+
}

web_src/js/components/DashboardRepoList.vue

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const sfc = {
113113
this.changeReposFilter(this.reposFilter);
114114
fomanticQuery(el.querySelector('.ui.dropdown')).dropdown();
115115
nextTick(() => {
116-
this.$refs.search.focus();
116+
this.$refs.search?.focus();
117117
});
118118
119119
this.textArchivedFilterTitles = {
@@ -340,6 +340,7 @@ const sfc = {
340340
export function initDashboardRepoList() {
341341
const el = document.querySelector('#dashboard-repo-list');
342342
if (el) {
343+
el.classList.remove('is-loading');
343344
createApp(sfc).mount(el);
344345
}
345346
}
@@ -362,10 +363,25 @@ export default sfc; // activate the IDE's Vue plugin
362363
<svg-icon name="octicon-plus"/>
363364
</a>
364365
</h4>
365-
<div class="ui attached segment repos-search">
366+
<div v-if="isLoading" class="ui attached segment" :class="{'is-loading': isLoading}"/>
367+
<div v-if="!isLoading && !repos.length" class="ui attached segment empty-placeholder">
368+
<svg-icon name="octicon-no-entry" :size="48" class-name="repo-list-icon"/>
369+
<h2>{{ textNoRepo }}</h2>
370+
<p>
371+
<a :href="subUrl + '/repo/create'">
372+
<svg-icon name="octicon-plus" :size="16" class-name="repo-list-icon"/> {{ textNewRepo }}
373+
</a>
374+
</p>
375+
<p v-if="canCreateMigrations">
376+
<a :href="subUrl + '/repo/migrate'">
377+
<svg-icon name="octicon-repo-push" :size="16" class-name="repo-list-icon"/> {{ textNewMigrate }}
378+
</a>
379+
</p>
380+
</div>
381+
<div v-if="repos.length" class="ui attached segment repos-search">
366382
<div class="ui small fluid action left icon input">
367383
<input type="search" spellcheck="false" maxlength="255" @input="changeReposFilter(reposFilter)" v-model="searchQuery" ref="search" @keydown="reposFilterKeyControl" :placeholder="textSearchRepos">
368-
<i class="icon loading-icon-3px" :class="{'is-loading': isLoading}"><svg-icon name="octicon-search" :size="16"/></i>
384+
<i class="icon loading-icon-3px"><svg-icon name="octicon-search" :size="16"/></i>
369385
<div class="ui dropdown icon button" :title="textFilter">
370386
<svg-icon name="octicon-filter" :size="16"/>
371387
<div class="menu">
@@ -475,6 +491,16 @@ export default sfc; // activate the IDE's Vue plugin
475491
<svg-icon name="octicon-plus"/>
476492
</a>
477493
</h4>
494+
<div v-if="isLoading" class="ui attached segment" :class="{'is-loading': isLoading}"/>
495+
<div v-if="!isLoading && !organizations.length" class="ui attached segment empty-placeholder">
496+
<svg-icon name="octicon-no-entry" :size="48" class-name="repo-list-icon"/>
497+
<h2>{{ textNoOrg }}</h2>
498+
<p v-if="canCreateOrganization">
499+
<a :href="subUrl + '/org/create'">
500+
<svg-icon name="octicon-organization" :size="16" class-name="repo-list-icon"/> {{ textNewOrg }}
501+
</a>
502+
</p>
503+
</div>
478504
<div v-if="organizations.length" class="ui attached table segment tw-rounded-b">
479505
<ul class="repo-owner-name-list">
480506
<li class="tw-flex tw-items-center tw-py-2" v-for="org in organizations" :key="org.name">

web_src/js/svg.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ import octiconLock from '../../public/assets/img/svg/octicon-lock.svg';
5050
import octiconMeter from '../../public/assets/img/svg/octicon-meter.svg';
5151
import octiconMilestone from '../../public/assets/img/svg/octicon-milestone.svg';
5252
import octiconMirror from '../../public/assets/img/svg/octicon-mirror.svg';
53+
import octiconNoEntry from '../../public/assets/img/svg/octicon-no-entry.svg';
5354
import octiconOrganization from '../../public/assets/img/svg/octicon-organization.svg';
5455
import octiconPlay from '../../public/assets/img/svg/octicon-play.svg';
5556
import octiconPlus from '../../public/assets/img/svg/octicon-plus.svg';
5657
import octiconProject from '../../public/assets/img/svg/octicon-project.svg';
5758
import octiconQuote from '../../public/assets/img/svg/octicon-quote.svg';
5859
import octiconRepo from '../../public/assets/img/svg/octicon-repo.svg';
5960
import octiconRepoForked from '../../public/assets/img/svg/octicon-repo-forked.svg';
61+
import octiconRepoPush from '../../public/assets/img/svg/octicon-repo-push.svg';
6062
import octiconRepoTemplate from '../../public/assets/img/svg/octicon-repo-template.svg';
6163
import octiconRss from '../../public/assets/img/svg/octicon-rss.svg';
6264
import octiconScreenFull from '../../public/assets/img/svg/octicon-screen-full.svg';
@@ -126,13 +128,15 @@ const svgs = {
126128
'octicon-meter': octiconMeter,
127129
'octicon-milestone': octiconMilestone,
128130
'octicon-mirror': octiconMirror,
131+
'octicon-no-entry': octiconNoEntry,
129132
'octicon-organization': octiconOrganization,
130133
'octicon-play': octiconPlay,
131134
'octicon-plus': octiconPlus,
132135
'octicon-project': octiconProject,
133136
'octicon-quote': octiconQuote,
134137
'octicon-repo': octiconRepo,
135138
'octicon-repo-forked': octiconRepoForked,
139+
'octicon-repo-push': octiconRepoPush,
136140
'octicon-repo-template': octiconRepoTemplate,
137141
'octicon-rss': octiconRss,
138142
'octicon-screen-full': octiconScreenFull,

0 commit comments

Comments
 (0)