From be36d6af3ba3e1541085df156dd2a81e2dc8896f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Tue, 2 Jul 2024 11:02:38 +0200 Subject: [PATCH] fix: prevent dangling list item MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By moving the fallback text into its own component I was able to move the list element into the History molecule. Its API has changed accordingly. I have written tests to prevent regressions. Signed-off-by: André Jaenisch --- .../components/atoms/HistoryFallback.svelte | 54 +++++++++++ src/lib/components/molecules/History.svelte | 69 ++++++++++---- src/lib/components/templates/Profile.svelte | 43 ++------- .../components/atoms/HistoryFallback.test.ts | 95 +++++++++++++++++++ tests/components/molecules/History.test.ts | 2 +- 5 files changed, 206 insertions(+), 57 deletions(-) create mode 100644 src/lib/components/atoms/HistoryFallback.svelte create mode 100644 tests/components/atoms/HistoryFallback.test.ts diff --git a/src/lib/components/atoms/HistoryFallback.svelte b/src/lib/components/atoms/HistoryFallback.svelte new file mode 100644 index 0000000..8971473 --- /dev/null +++ b/src/lib/components/atoms/HistoryFallback.svelte @@ -0,0 +1,54 @@ + + + + + + + + + + + {$date(new Date('2023-04-23'))} - {$_('page.profile.history.activities.setup.summary')} + + + + + + {$_('page.profile.history.activities.setup.description', { + values: { + created_with, + instance, + username + } + })} + + diff --git a/src/lib/components/molecules/History.svelte b/src/lib/components/molecules/History.svelte index 386e185..d4e6503 100644 --- a/src/lib/components/molecules/History.svelte +++ b/src/lib/components/molecules/History.svelte @@ -12,14 +12,28 @@ You should have received a copy of the GNU Affero General Public License along w --> -{#each Object.entries(groupCommitsByDateAndProject(commitsMap)) as commitsByDateAndProject} - {#each Object.entries(commitsByDateAndProject[1]) as commitsByProject} -
  • - -
    - -
      - {#each commitsByProject[1] as commit} -
    • - -
    • - {/each} -
    -
    +

    + {$_('page.profile.history.heading')} +

    +
      + {#if commitsMap.length > 0} + {#each Object.entries(groupCommitsByDateAndProject(commitsMap)) as commitsByDateAndProject} + {#each Object.entries(commitsByDateAndProject[1]) as commitsByProject} +
    • + +
      + +
        + {#each commitsByProject[1] as commit} +
      • + +
      • + {/each} +
      +
      +
    • + {/each} + {/each} + {:else} +
    • +
    • - {/each} -{/each} + {/if} +
    diff --git a/src/lib/components/templates/Profile.svelte b/src/lib/components/templates/Profile.svelte index 2bda41d..aeded83 100644 --- a/src/lib/components/templates/Profile.svelte +++ b/src/lib/components/templates/Profile.svelte @@ -12,8 +12,8 @@ You should have received a copy of the GNU Affero General Public License along w -->