5297ea175f
I have added atoms, molecules and icons. Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
324 lines
8.8 KiB
TypeScript
324 lines
8.8 KiB
TypeScript
/* Stories for History molecule.
|
|
* Copyright (C) 2024 André Jaenisch
|
|
* SPDX-FileCopyrightText: 2024 André Jaenisch
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*
|
|
* This 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.
|
|
*
|
|
* This 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.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import type { Meta, StoryObj } from '@storybook/svelte';
|
|
|
|
import History from '$lib/components/molecules/History.svelte';
|
|
|
|
const meta = {
|
|
title: 'Molecules/History',
|
|
component: History,
|
|
tags: ['autodocs']
|
|
} satisfies Meta<History>;
|
|
|
|
const followingsMap = [
|
|
{
|
|
'@context': [
|
|
'https://www.w3.org/ns/activitystreams',
|
|
'https://w3id.org/security/v2',
|
|
'https://forgefed.org/ns'
|
|
],
|
|
id: 'https://fig.fr33domlover.site/repos/9nOkn',
|
|
inbox: 'https://fig.fr33domlover.site/repos/9nOkn/inbox',
|
|
outbox: 'https://fig.fr33domlover.site/repos/9nOkn/outbox',
|
|
followers: 'https://fig.fr33domlover.site/repos/9nOkn/followers',
|
|
publicKey: ['https://fig.fr33domlover.site/akey1', 'https://fig.fr33domlover.site/akey2'],
|
|
type: 'Repository',
|
|
name: 'Very fun demo',
|
|
summary: 'Testing MR demo',
|
|
team: null,
|
|
versionControlSystem: 'https://forgefed.org/ns#git',
|
|
sendPatchesTo: 'https://fig.fr33domlover.site/looms/9nOkn',
|
|
cloneUri: 'https://fig.fr33domlover.site/repos/9nOkn',
|
|
collaborators: 'https://fig.fr33domlover.site/repos/9nOkn/collabs',
|
|
context: 'https://fig.fr33domlover.site/repos/9nOkn/projects'
|
|
},
|
|
{
|
|
'@context': [
|
|
'https://www.w3.org/ns/activitystreams',
|
|
'https://w3id.org/security/v2',
|
|
'https://forgefed.org/ns'
|
|
],
|
|
id: 'https://fig.fr33domlover.site/repos/Pn9Yn',
|
|
inbox: 'https://fig.fr33domlover.site/repos/Pn9Yn/inbox',
|
|
outbox: 'https://fig.fr33domlover.site/repos/Pn9Yn/outbox',
|
|
followers: 'https://fig.fr33domlover.site/repos/Pn9Yn/followers',
|
|
publicKey: ['https://fig.fr33domlover.site/akey1', 'https://fig.fr33domlover.site/akey2'],
|
|
type: 'Repository',
|
|
name: 'Anvil',
|
|
summary: 'Mirror of Anvil so I can develop its UI',
|
|
team: null,
|
|
versionControlSystem: 'https://forgefed.org/ns#git',
|
|
cloneUri: 'https://fig.fr33domlover.site/repos/Pn9Yn',
|
|
collaborators: 'https://fig.fr33domlover.site/repos/Pn9Yn/collabs',
|
|
context: 'https://fig.fr33domlover.site/repos/Pn9Yn/projects'
|
|
}
|
|
];
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Empty: Story = {
|
|
args: {
|
|
commitsMap: [],
|
|
followingsMap: []
|
|
}
|
|
};
|
|
|
|
export const SingleDateSingleProjectSingleCommit: Story = {
|
|
args: {
|
|
commitsMap: generateCommits([
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
}
|
|
]),
|
|
followingsMap
|
|
}
|
|
};
|
|
|
|
export const SingleDateSingleProjectMultipleCommits: Story = {
|
|
args: {
|
|
commitsMap: generateCommits([
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
}
|
|
]),
|
|
followingsMap
|
|
}
|
|
};
|
|
|
|
export const SingleDateMultipleProjectsSingleCommit: Story = {
|
|
args: {
|
|
commitsMap: generateCommits([
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-09-28T17:06:36Z',
|
|
repoId: '9nOkn'
|
|
}
|
|
]),
|
|
followingsMap
|
|
}
|
|
};
|
|
|
|
export const SingleDateMultipleProjectsMultipleCommits: Story = {
|
|
args: {
|
|
commitsMap: generateCommits([
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: '9nOkn'
|
|
},
|
|
{
|
|
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-09-28T17:06:36Z',
|
|
repoId: '9nOkn'
|
|
}
|
|
]),
|
|
followingsMap
|
|
}
|
|
};
|
|
|
|
export const MultipleDatesSingleProjectSingleCommit: Story = {
|
|
args: {
|
|
commitsMap: generateCommits([
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-10-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
}
|
|
]),
|
|
followingsMap
|
|
}
|
|
};
|
|
|
|
export const MultipleDatesSingleProjectMultipleCommits: Story = {
|
|
args: {
|
|
commitsMap: generateCommits([
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-10-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-10-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
}
|
|
]),
|
|
|
|
followingsMap
|
|
}
|
|
};
|
|
|
|
export const MultipleDatesMultipleProjectsSingleCommit: Story = {
|
|
args: {
|
|
commitsMap: generateCommits([
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-10-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-09-28T17:06:36Z',
|
|
repoId: '9nOkn'
|
|
},
|
|
{
|
|
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-10-28T17:06:36Z',
|
|
repoId: '9nOkn'
|
|
}
|
|
]),
|
|
followingsMap
|
|
}
|
|
};
|
|
|
|
export const MultipleDatesMultipleProjectsMultipleCommits: Story = {
|
|
args: {
|
|
commitsMap: generateCommits([
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-10-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-10-28T17:01:30Z',
|
|
repoId: 'Pn9Yn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-09-28T17:01:30Z',
|
|
repoId: '9nOkn'
|
|
},
|
|
{
|
|
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-09-28T17:06:36Z',
|
|
repoId: '9nOkn'
|
|
},
|
|
{
|
|
commitId: '36e1bb146fa3a6fb5c8d490f76ff4cca5f8f2e78',
|
|
commitName: 'Initial commit',
|
|
committed: '2022-10-28T17:01:30Z',
|
|
repoId: '9nOkn'
|
|
},
|
|
{
|
|
commitId: 'd6e409a6b536e026c95f64d2732946ba0136ddb1',
|
|
commitName: 'Best commit ever',
|
|
committed: '2022-10-28T17:06:36Z',
|
|
repoId: '9nOkn'
|
|
}
|
|
]),
|
|
followingsMap
|
|
}
|
|
};
|
|
|
|
function generateCommits(metadata) {
|
|
return metadata.map((metadatum) => {
|
|
const { repoId, commitId, commitName, committed } = metadatum;
|
|
|
|
return {
|
|
'@context': ['https://www.w3.org/ns/activitystreams', 'https://forgefed.org/ns'],
|
|
id: `https://fig.fr33domlover.site/repos/${repoId}/commits/${commitId}`,
|
|
type: 'Commit',
|
|
context: `https://fig.fr33domlover.site/repos/${repoId}`,
|
|
attributedTo: 'https://fig.fr33domlover.site/people/qn870',
|
|
committedBy: {
|
|
name: 'vervis',
|
|
mbox: 'mailto:vervis@vervis.vervis'
|
|
},
|
|
name: commitName,
|
|
hash: commitId,
|
|
created: committed,
|
|
committed
|
|
};
|
|
});
|
|
}
|