feat: display commits as activity
I also learned how to pluralise. I'm curious whether Weblate can handle that. It follows ICU standard at least. Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
parent
d3fc06a239
commit
e9c76418eb
6 changed files with 163 additions and 23 deletions
|
@ -13,7 +13,14 @@ You should have received a copy of the GNU Affero General Public License along w
|
|||
|
||||
<script>
|
||||
import { _, date } from 'svelte-i18n';
|
||||
import { NorthStar24, Star16 } from 'svelte-octicons';
|
||||
import {
|
||||
Copy16,
|
||||
FileDirectory16,
|
||||
GitCommit24,
|
||||
NorthStar24,
|
||||
Repo24,
|
||||
Star16
|
||||
} from 'svelte-octicons';
|
||||
|
||||
import Avatar from '../atoms/Avatar.svelte';
|
||||
import BlockOrReport from '../atoms/BlockOrReport.svelte';
|
||||
|
@ -157,6 +164,16 @@ You should have received a copy of the GNU Affero General Public License along w
|
|||
<p>These are the contents of the items in the previous dump.</p>
|
||||
<pre>{JSON.stringify(data.user.collaboratorsMap, null, 2)}</pre>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Commits</summary>
|
||||
<p>These are the contents of the items in the previous dump.</p>
|
||||
<pre>{JSON.stringify(data.user.commits, null, 2)}</pre>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Commits mapped</summary>
|
||||
<p>These are the contents of the items in the previous dump.</p>
|
||||
<pre>{JSON.stringify(data.user.commitsMap, null, 2)}</pre>
|
||||
</details>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
|
@ -181,6 +198,88 @@ You should have received a copy of the GNU Affero General Public License along w
|
|||
{$_('page.profile.history.heading')}
|
||||
</h2>
|
||||
<ul>
|
||||
{#if data?.user?.commitsMap}
|
||||
<!-- Commit day -->
|
||||
<li>
|
||||
<!-- Indent the whole block by 6 -->
|
||||
<div class="flex flex-col gap-6 ps-6">
|
||||
<!-- Commit date -->
|
||||
<!-- But align the icon to History heading -->
|
||||
<div class="flex gap-6 -ms-6">
|
||||
<!-- I don't group commits by date at the moment. -->
|
||||
<span class="bg-white">
|
||||
<GitCommit24 fill="currentColor" />
|
||||
</span>
|
||||
<!-- And align the date with the commits below -->
|
||||
<span class="flex gap-6 -ms-3">
|
||||
<!-- Manually remove the failed commit map fetch from the equation -->
|
||||
<!-- Pluralisation: https://lokalise.com/blog/svelte-i18n/#Pluralization_with_Svelte_i18n -->
|
||||
{$date(new Date(data.user.commitsMap[0].created))} - {$_(
|
||||
'page.profile.history.activities.commits.number',
|
||||
{ values: { number: data.user.commitsMap.length - 1 } }
|
||||
)}
|
||||
<span class="flex gap-2">
|
||||
<Repo24 fill="currentColor" />
|
||||
<!-- Pick a repo with known commits -->
|
||||
{data.user.followingsMap[3].name}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<!-- Commits -->
|
||||
<ul>
|
||||
{#each data.user.commitsMap as commit}
|
||||
{#if commit.name}
|
||||
<li class="ltr:border-l-2 rtl:border-r-2 ms-2">
|
||||
<!-- Commit body -->
|
||||
<div class="flex w-full justify-between gap-4 border border-surface-100">
|
||||
<!-- Detail text -->
|
||||
<div class="flex flex-col flex-1">
|
||||
<span class="text-surface-500">{commit.name}</span>
|
||||
<span class="text-surface-400"
|
||||
>{$_('page.profile.history.activities.commits.relative_time', {
|
||||
values: { relativeTime: $date(new Date(commit.committed)) }
|
||||
})}</span
|
||||
>
|
||||
</div>
|
||||
<!-- SHA -->
|
||||
<div class="flex">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-icon border border-surface-100 rounded bg-white self-start"
|
||||
>
|
||||
<Copy16 fill="currentColor" />
|
||||
<span class="sr-only"
|
||||
>{$_('page.profile.history.activities.commits.actions.copy')}</span
|
||||
>
|
||||
</button>
|
||||
<!-- Since I cannot successfully define font-mono here, enforce a minimum width for equally sized buttons -->
|
||||
<button
|
||||
type="button"
|
||||
class="btn border border-surface-100 rounded bg-white min-w-32 self-start"
|
||||
>
|
||||
{commit.hash.slice(0, 8)}
|
||||
</button>
|
||||
</div>
|
||||
<!-- Browse -->
|
||||
<div>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-icon border border-surface-100 rounded bg-white"
|
||||
>
|
||||
<FileDirectory16 fill="currentColor" />
|
||||
<span class="sr-only"
|
||||
>{$_('page.profile.history.activities.commits.actions.browse')}</span
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
{/each}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
{:else}
|
||||
<li class="flex flex-col ltr:border-l-2 rtl:border-r-2 ms-2">
|
||||
<!-- Commit day -->
|
||||
<span class="relative">
|
||||
|
@ -206,6 +305,7 @@ You should have received a copy of the GNU Affero General Public License along w
|
|||
</span>
|
||||
</span>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -66,6 +66,14 @@
|
|||
"heading": "",
|
||||
"history": {
|
||||
"activities": {
|
||||
"commits": {
|
||||
"actions": {
|
||||
"browse": "",
|
||||
"copy": ""
|
||||
},
|
||||
"number": "",
|
||||
"relative_time": ""
|
||||
},
|
||||
"setup": {
|
||||
"description": "",
|
||||
"summary": ""
|
||||
|
|
|
@ -66,6 +66,14 @@
|
|||
"heading": "Profil für",
|
||||
"history": {
|
||||
"activities": {
|
||||
"commits": {
|
||||
"actions": {
|
||||
"browse": "",
|
||||
"copy": ""
|
||||
},
|
||||
"number": "",
|
||||
"relative_time": ""
|
||||
},
|
||||
"setup": {
|
||||
"description": "Das F2-Konto @{username}@{instance} wurde erfolgreich innerhalb von {created_with} erstellt",
|
||||
"summary": "Kontoeinstellungen"
|
||||
|
|
|
@ -66,6 +66,14 @@
|
|||
"heading": "Profile for",
|
||||
"history": {
|
||||
"activities": {
|
||||
"commits": {
|
||||
"actions": {
|
||||
"browse": "Browse",
|
||||
"copy": "Copy"
|
||||
},
|
||||
"number": "{number, plural, one{# commit} other{# commits}}",
|
||||
"relative_time": "committed {relativeTime}"
|
||||
},
|
||||
"setup": {
|
||||
"description": "The F2 account @{username}@{instance} was successfully set up within {created_with}",
|
||||
"summary": "account set up"
|
||||
|
|
|
@ -66,6 +66,14 @@
|
|||
"heading": "הפרופיל של",
|
||||
"history": {
|
||||
"activities": {
|
||||
"commits": {
|
||||
"actions": {
|
||||
"browse": "",
|
||||
"copy": ""
|
||||
},
|
||||
"number": "",
|
||||
"relative_time": ""
|
||||
},
|
||||
"setup": {
|
||||
"description": "",
|
||||
"summary": ""
|
||||
|
|
|
@ -66,6 +66,14 @@
|
|||
"heading": "Profil dla",
|
||||
"history": {
|
||||
"activities": {
|
||||
"commits": {
|
||||
"actions": {
|
||||
"browse": "",
|
||||
"copy": ""
|
||||
},
|
||||
"number": "",
|
||||
"relative_time": ""
|
||||
},
|
||||
"setup": {
|
||||
"description": "Konto F2 @{username}@{instance} zostało poprawnie ustawione z {created_with}",
|
||||
"summary": "ustawienia konta"
|
||||
|
|
Loading…
Reference in a new issue