From d32eb07837ccb50429b11f9916e667ef2c8e55d4 Mon Sep 17 00:00:00 2001 From: Kerwin Bryant Date: Thu, 26 Dec 2024 07:38:20 +0000 Subject: [PATCH 01/16] Optimize the dashboard --- options/locale/locale_en-US.ini | 5 ++++ templates/user/dashboard/dashboard.tmpl | 1 + templates/user/dashboard/guide.tmpl | 8 ++++++ templates/user/dashboard/repolist.tmpl | 7 ++++- web_src/css/dashboard.css | 4 +++ web_src/js/components/DashboardRepoList.vue | 32 +++++++++++++++++++-- web_src/js/svg.ts | 4 +++ 7 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 templates/user/dashboard/guide.tmpl diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ea4d36fb1ca7d..4d709af4af1c4 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -27,6 +27,9 @@ licenses = Licenses return_to_gitea = Return to Gitea more_items = More items +guide.welcome = Welcome to the Gitea. +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. + username = Username email = Email Address password = Password @@ -1010,6 +1013,7 @@ visibility.private = Private visibility.private_tooltip = Visible only to members of organizations you have joined [repo] +empty = There are no repositories yet. new_repo_helper = A repository contains all project files, including revision history. Already hosting one elsewhere? Migrate repository. owner = Owner 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 recent_commits.what = recent commits [org] +empty = There are no organizations yet. org_name_holder = Organization Name org_full_name_holder = Organization Full Name org_name_helper = Organization names should be short and memorable. diff --git a/templates/user/dashboard/dashboard.tmpl b/templates/user/dashboard/dashboard.tmpl index 5dc46dc0a5d0a..17d1a44dd9fd3 100644 --- a/templates/user/dashboard/dashboard.tmpl +++ b/templates/user/dashboard/dashboard.tmpl @@ -5,6 +5,7 @@
{{template "base/alert" .}} {{template "user/heatmap" .}} + {{template "user/dashboard/guide" .}} {{template "user/dashboard/feeds" .}}
{{template "user/dashboard/repolist" .}} diff --git a/templates/user/dashboard/guide.tmpl b/templates/user/dashboard/guide.tmpl new file mode 100644 index 0000000000000..feebfc25eed81 --- /dev/null +++ b/templates/user/dashboard/guide.tmpl @@ -0,0 +1,8 @@ +{{if not .Feeds}} +
+ +

{{ctx.Locale.Tr "guide.welcome"}}

+

{{ctx.Locale.Tr "guide.welcome_desc"}}

+
+{{end}} + diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl index a2764ba608442..8edb64c4ae820 100644 --- a/templates/user/dashboard/repolist.tmpl +++ b/templates/user/dashboard/repolist.tmpl @@ -5,10 +5,15 @@ const data = { isMirrorsEnabled: {{.MirrorsEnabled}}, isStarsEnabled: {{not .IsDisableStars}}, + canCreateMigrations: {{not .DisableMigrations}}, + + textNoOrg: {{ctx.Locale.Tr "org.empty"}}, + textNoRepo: {{ctx.Locale.Tr "repo.empty"}}, textRepository: {{ctx.Locale.Tr "repository"}}, textOrganization: {{ctx.Locale.Tr "organization"}}, textMyRepos: {{ctx.Locale.Tr "home.my_repos"}}, textNewRepo: {{ctx.Locale.Tr "new_repo"}}, + textNewMigrate: {{ctx.Locale.Tr "new_migrate"}}, textSearchRepos: {{ctx.Locale.Tr "search.repo_kind"}}, textFilter: {{ctx.Locale.Tr "home.filter"}}, textShowArchived: {{ctx.Locale.Tr "home.show_archived"}}, @@ -56,4 +61,4 @@ data.organizationId = {{.ContextUser.ID}}; window.config.pageData.dashboardRepoList = data; -
+
diff --git a/web_src/css/dashboard.css b/web_src/css/dashboard.css index 0962215ac6ad8..9f97d0a5e4157 100644 --- a/web_src/css/dashboard.css +++ b/web_src/css/dashboard.css @@ -70,3 +70,7 @@ .dashboard .secondary-nav .ui.dropdown { max-width: 100%; } + +.dashboard #dashboard-repo-list.is-loading { + aspect-ratio: 5.415; /* the size is about 790 x 145 */ +} diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue index 41793d60ed66d..d4f130c056881 100644 --- a/web_src/js/components/DashboardRepoList.vue +++ b/web_src/js/components/DashboardRepoList.vue @@ -113,7 +113,7 @@ const sfc = { this.changeReposFilter(this.reposFilter); fomanticQuery(el.querySelector('.ui.dropdown')).dropdown(); nextTick(() => { - this.$refs.search.focus(); + this.$refs.search?.focus(); }); this.textArchivedFilterTitles = { @@ -340,6 +340,7 @@ const sfc = { export function initDashboardRepoList() { const el = document.querySelector('#dashboard-repo-list'); if (el) { + el.classList.remove('is-loading'); createApp(sfc).mount(el); } } @@ -362,10 +363,25 @@ export default sfc; // activate the IDE's Vue plugin -