1 line
No EOL
7.3 KiB
Text
1 line
No EOL
7.3 KiB
Text
{"version":3,"file":"History-DDyrwdq-.js","sources":["../../src/lib/components/atoms/HistoryFallback.svelte","../../src/lib/components/molecules/History.svelte"],"sourcesContent":["<!--\nHistoryFallback atom.\nCopyright (C) 2024 André Jaenisch\nSPDX-FileCopyrightText: 2024 André Jaenisch\nSPDX-License-Identifier: AGPL-3.0-or-later\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.\n-->\n\n<script>\n\timport { _, date } from 'svelte-i18n';\n\timport { NorthStar24 } from 'svelte-octicons';\n\n\t/**\n\t * Service with which username was created on the instance.\n\t */\n\texport let created_with = '';\n\n\t/**\n\t * Instance to show in fallback.\n\t */\n\texport let instance = '';\n\n\t/**\n\t * Username to show in fallback.\n\t */\n\texport let username = '';\n</script>\n\n<!-- Commit day -->\n<span class=\"relative\">\n\t<span class=\"absolute ltr:-left-3 rtl:-right-3\">\n\t\t<NorthStar24 fill=\"currentColor\" />\n\t</span>\n\t<span class=\"ms-4\">\n\t\t{$date(new Date('2023-04-23'))} - {$_('page.profile.history.activities.setup.summary')}\n\t</span>\n</span>\n<!-- Commits -->\n<span class=\"ms-6 mt-8\">\n\t<span class=\"border box-decoration-clone px-4 py-2 leading-10\">\n\t\t{$_('page.profile.history.activities.setup.description', {\n\t\t\tvalues: {\n\t\t\t\tcreated_with,\n\t\t\t\tinstance,\n\t\t\t\tusername\n\t\t\t}\n\t\t})}\n\t</span>\n</span>\n","<!--\nHistory molecule.\nCopyright (C) 2024 André Jaenisch\nSPDX-FileCopyrightText: 2024 André Jaenisch\nSPDX-License-Identifier: AGPL-3.0-or-later\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.\n-->\n\n<script>\n\timport { _ } from 'svelte-i18n';\n\n\timport CommitBody from '../atoms/CommitBody.svelte';\n\timport CommitDate from '../atoms/CommitDate.svelte';\n\timport HistoryFallback from '../atoms/HistoryFallback.svelte';\n\n\t/**\n\t * Array of commits to display by date and project.\n\t */\n\texport let commitsMap = [];\n\n\t/**\n\t * Required context for populating the template.\n\t */\n\texport let data = {\n\t\tuser: {\n\t\t\tcreated_with: '',\n\t\t\tinstance: '',\n\t\t\tusername: ''\n\t\t}\n\t};\n\n\t/**\n\t * Array of followings to look up.\n\t */\n\texport let followingsMap = [];\n\n\t/* Since I group commits by date and project I need to create a structure. */\n\tconst groupCommitsByDateAndProject = function (commitsMap) {\n\t\tconst groupByDateAndProject = {};\n\t\tcommitsMap\n\t\t\t// Some commits couldn't be fetched from Vervis\n\t\t\t.filter((commit) => Boolean(commit.id))\n\t\t\t.forEach((commit) => {\n\t\t\t\tconst { committed, context } = commit;\n\t\t\t\t// Committed is formatted as ISO date. Group by date no matter the time\n\t\t\t\tconst date = committed.slice(0, committed.indexOf('T'));\n\n\t\t\t\t// Ensure key exists\n\t\t\t\tif (!groupByDateAndProject[date]) {\n\t\t\t\t\tgroupByDateAndProject[date] = {};\n\t\t\t\t}\n\n\t\t\t\t// Ensure Array exists\n\t\t\t\tif (!groupByDateAndProject[date][context]) {\n\t\t\t\t\tgroupByDateAndProject[date][context] = [];\n\t\t\t\t}\n\n\t\t\t\tgroupByDateAndProject[date][context].push(commit);\n\t\t\t});\n\n\t\treturn groupByDateAndProject;\n\t};\n\n\tconst getRepoNameById = function (repoId) {\n\t\tconst candidate = followingsMap.find((following) => following.id === repoId);\n\n\t\treturn candidate?.name || '';\n\t};\n</script>\n\n<h2 class=\"h2 font-semibold leading-tight text-base\">\n\t{$_('page.profile.history.heading')}\n</h2>\n<ul>\n\t{#if commitsMap.length > 0}\n\t\t{#each Object.entries(groupCommitsByDateAndProject(commitsMap)) as commitsByDateAndProject}\n\t\t\t{#each Object.entries(commitsByDateAndProject[1]) as commitsByProject}\n\t\t\t\t<li class=\"mb-8\">\n\t\t\t\t\t<!-- Indent the whole block by 6 -->\n\t\t\t\t\t<div class=\"flex flex-col gap-6 ps-6\">\n\t\t\t\t\t\t<CommitDate\n\t\t\t\t\t\t\tcommitDate={commitsByDateAndProject[0]}\n\t\t\t\t\t\t\tnumberOfCommits={commitsByProject[1].length}\n\t\t\t\t\t\t\trepoName={getRepoNameById(commitsByProject[0])}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t{#each commitsByProject[1] as commit}\n\t\t\t\t\t\t\t\t<li class=\"ltr:border-l-2 rtl:border-r-2 ms-2\">\n\t\t\t\t\t\t\t\t\t<CommitBody {commit} />\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t{/each}\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t{/each}\n\t\t{/each}\n\t{:else}\n\t\t<li class=\"flex flex-col ltr:border-l-2 rtl:border-r-2 ms-2\">\n\t\t\t<HistoryFallback\n\t\t\t\tcreated_with={data.user.created_with}\n\t\t\t\tinstance={data.user.instance}\n\t\t\t\tusername={data.user.username}\n\t\t\t/>\n\t\t</li>\n\t{/if}\n</ul>\n"],"names":["ctx","Date","t1","t2","t3_value","cov_1gflcabdx7","s","t3","t4","span4","span3","t5_value","values","created_with","instance","username","b","set_data","t1_value","current","dirty","div","ul","cov_xqx5ndjfu"],"mappings":"mhjBAuCqCA,EAAA,CAAA,EAAA,IAA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