1 line
No EOL
9.7 KiB
Text
1 line
No EOL
9.7 KiB
Text
{"version":3,"file":"Profile-AjlChAZK.js","sources":["../../src/lib/components/templates/Profile.svelte"],"sourcesContent":["<!--\nProfile template.\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\timport { Star16 } from 'svelte-octicons';\n\n\timport Avatar from '../atoms/Avatar.svelte';\n\timport BlockOrReport from '../atoms/BlockOrReport.svelte';\n\timport Created from '../atoms/Created.svelte';\n\timport DisplayName from '../atoms/DisplayName.svelte';\n\timport History from '../molecules/History.svelte';\n\timport MainMenu from '../molecules/MainMenu.svelte';\n\timport Project from '../molecules/Project.svelte';\n\n\t/**\n\t * Translation keys.\n\t */\n\tconst i18n = {\n\t\tbuttons: {\n\t\t\tfork: 'page.profile.projects.actions.fork',\n\t\t\tstar: 'page.profile.projects.actions.star',\n\t\t\twatch: 'page.profile.projects.actions.watch'\n\t\t},\n\t\theading: 'page.profile.heading'\n\t};\n\n\t/**\n\t * Required context for populating the template.\n\t * @type {*}\n\t */\n\texport let data = {\n\t\tlocale: '',\n\t\tuser: {\n\t\t\tavatar: '',\n\t\t\tcreated_at: null,\n\t\t\tcreated_with: '',\n\t\t\tdisplay_name: '',\n\t\t\tinstance: '',\n\t\t\tpronoun: '',\n\t\t\tusername: ''\n\t\t}\n\t};\n\n\t/**\n\t * Allow for linking stories in Storybook.\n\t */\n\texport let sb = '';\n\n\t/* Since I fetch collaborators for every following I need to filter. */\n\tconst mapCollaboratorsToMember = function (people, collaborators, associatedProject) {\n\t\tconst candidates = collaborators.filter((collaborator) => {\n\t\t\treturn collaborator.context === associatedProject;\n\t\t});\n\n\t\treturn candidates\n\t\t\t.map((candidate) => candidate.items)\n\t\t\t.map((members) => {\n\t\t\t\treturn people.find((person) => members.find((member) => person.id === member.object));\n\t\t\t})\n\t\t\t.flat(1);\n\t};\n</script>\n\n<div class=\"flex h-full w-full\">\n\t<aside class=\"w-[400px]\">\n\t\t<MainMenu />\n\t</aside>\n\t<main>\n\t\t<section class=\"w-full mx-auto flex px-8 pt-8\">\n\t\t\t<!-- Profile header -->\n\t\t\t<div>\n\t\t\t\t<Avatar avatar={data.user.avatar} displayName={data.user.display_name} />\n\t\t\t</div>\n\t\t\t<!-- Board -->\n\t\t\t<div class=\"flex flex-1 flex-col ps-8\">\n\t\t\t\t<div class=\"self-end\">\n\t\t\t\t\t<Created created_at={data.user.created_at} locale={data.locale} />\n\t\t\t\t\t<BlockOrReport />\n\t\t\t\t</div>\n\t\t\t\t<!-- Top Row -->\n\t\t\t\t<div class=\"flex mt-2\">\n\t\t\t\t\t<!-- Board -->\n\t\t\t\t\t<div class=\"flex flex-col flex-1 gap-2\">\n\t\t\t\t\t\t<div class=\"flex items-end\">\n\t\t\t\t\t\t\t<DisplayName\n\t\t\t\t\t\t\t\tdisplayName={data.user.display_name}\n\t\t\t\t\t\t\t\t{i18n}\n\t\t\t\t\t\t\t\tpronoun={data.user.pronoun}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<span class=\"leading-tight\">\n\t\t\t\t\t\t\t{data.user.username}@{data.user.instance}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<!-- Interaction Links -->\n\t\t\t\t\t<button type=\"button\" class=\"btn-icon border rounded-none self-start\">\n\t\t\t\t\t\t<Star16 fill=\"currentColor\" />\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t\t<section class=\"w-full h-full mx-auto flex flex-wrap mt-8 px-8\">\n\t\t\t<!-- Board -->\n\t\t\t<div class=\"flex flex-1 flex-col px-4\">\n\t\t\t\t<div class=\"space-y-6\">\n\t\t\t\t\t<h2 class=\"h2 font-semibold leading-tight text-base px-4\">\n\t\t\t\t\t\t{$_('page.profile.projects.heading')}\n\t\t\t\t\t</h2>\n\t\t\t\t\t{#if data?.user?.followingsMap}\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t{#each data.user.followingsMap as following}\n\t\t\t\t\t\t\t\t{#if following.type === 'Project'}\n\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t<Project\n\t\t\t\t\t\t\t\t\t\t\tcollaborators={mapCollaboratorsToMember(\n\t\t\t\t\t\t\t\t\t\t\t\t[data.user.person],\n\t\t\t\t\t\t\t\t\t\t\t\tdata.user.collaboratorsMap,\n\t\t\t\t\t\t\t\t\t\t\t\tfollowing.id\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t{i18n}\n\t\t\t\t\t\t\t\t\t\t\tproject={following}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t\t{/each}\n\t\t\t\t\t\t</ul>\n\n\t\t\t\t\t\t<h2 class=\"h2 font-semibold leading-tight text-base px-4\">\n\t\t\t\t\t\t\t{$_('page.profile.repositories.heading')}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t<section class=\"flex flex-col gap-4\">\n\t\t\t\t\t\t\t{#each data.user.followingsMap as following}\n\t\t\t\t\t\t\t\t{#if following.type === 'Repository'}\n\t\t\t\t\t\t\t\t\t<div class=\"border border-surface-100\">\n\t\t\t\t\t\t\t\t\t\t<Project collaborators={[]} {i18n} project={following} />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t\t{/each}\n\t\t\t\t\t\t</section>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<p>The following is DEBUG information and will be removed in the near future.</p>\n\t\t\t\t\t\t\t{#if data?.user}\n\t\t\t\t\t\t\t\t<details>\n\t\t\t\t\t\t\t\t\t<summary>Person</summary>\n\t\t\t\t\t\t\t\t\t<pre>{JSON.stringify(data.user.person, null, 2)}</pre>\n\t\t\t\t\t\t\t\t</details>\n\t\t\t\t\t\t\t\t<details>\n\t\t\t\t\t\t\t\t\t<summary>Followings</summary>\n\t\t\t\t\t\t\t\t\t<pre>{JSON.stringify(data.user.followings, null, 2)}</pre>\n\t\t\t\t\t\t\t\t</details>\n\t\t\t\t\t\t\t\t<details>\n\t\t\t\t\t\t\t\t\t<summary>Followings mapped</summary>\n\t\t\t\t\t\t\t\t\t<p>These are the contents of the items in the previous dump.</p>\n\t\t\t\t\t\t\t\t\t<pre>{JSON.stringify(data.user.followingsMap, null, 2)}</pre>\n\t\t\t\t\t\t\t\t</details>\n\t\t\t\t\t\t\t\t<details>\n\t\t\t\t\t\t\t\t\t<summary>Collaborators mapped</summary>\n\t\t\t\t\t\t\t\t\t<p>These are the contents of the items in the previous dump.</p>\n\t\t\t\t\t\t\t\t\t<pre>{JSON.stringify(data.user.collaboratorsMap, null, 2)}</pre>\n\t\t\t\t\t\t\t\t</details>\n\t\t\t\t\t\t\t\t<details>\n\t\t\t\t\t\t\t\t\t<summary>Commits</summary>\n\t\t\t\t\t\t\t\t\t<p>These are the contents of the items in the previous dump.</p>\n\t\t\t\t\t\t\t\t\t<pre>{JSON.stringify(data.user.commits, null, 2)}</pre>\n\t\t\t\t\t\t\t\t</details>\n\t\t\t\t\t\t\t\t<details>\n\t\t\t\t\t\t\t\t\t<summary>Commits mapped</summary>\n\t\t\t\t\t\t\t\t\t<p>These are the contents of the items in the previous dump.</p>\n\t\t\t\t\t\t\t\t\t<pre>{JSON.stringify(data.user.commitsMap, null, 2)}</pre>\n\t\t\t\t\t\t\t\t</details>\n\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t{:else}\n\t\t\t\t\t\t<p class=\"px-4\">\n\t\t\t\t\t\t\t{$_('page.profile.projects.empty')}\n\t\t\t\t\t\t\t{@html $_('page.profile.projects.add_or_import', {\n\t\t\t\t\t\t\t\tvalues: {\n\t\t\t\t\t\t\t\t\taddElementOpen: '<a class=\"anchor\" href=\"#\">',\n\t\t\t\t\t\t\t\t\taddElementClose: '</a>',\n\t\t\t\t\t\t\t\t\timportElementOpen: `<a class=\"anchor\" href=\"/projects/import/\" data-sb-kind=${sb}>`,\n\t\t\t\t\t\t\t\t\timportElementClose: '</a>'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t{/if}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<!-- History -->\n\t\t\t<div class=\"flex flex-1 flex-col px-4\">\n\t\t\t\t<div class=\"space-y-6\">\n\t\t\t\t\t<History\n\t\t\t\t\t\tcommitsMap={data?.user?.commitsMap || []}\n\t\t\t\t\t\t{data}\n\t\t\t\t\t\tfollowingsMap={data?.user?.followingsMap || []}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t</main>\n</div>\n"],"names":["ctx","user","followingsMap","length","i","cov_tzx4jmcr4","s","each_blocks","insert_hydration","section0","div5","div4","div3","span","append_hydration","button","data","b","locale","avatar","candidates","collaborators","filter","collaborator","f","map","candidate","items","members","people","person","find","member","id","object","flat"],"mappings":"4k3HAyHSA,CAAAA,EAAAA,GAAAA,GAAAA,EAAAA,EAAAA,CAAAA,CAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,IAAAA,MAAAA,EAAAA,IAAAA,EAAAA,EAAAA,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,CAAAA,EAAAA,EA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