Browse Source

fix: repo name fallback as identifer

if it is not present in the repo event
master
DanConwayDev 2 years ago
parent
commit
b6eb83b498
No known key found for this signature in database
GPG Key ID: 68E15486D73F75E1
  1. BIN
      __snapshots__/repo-header--long-name.png
  2. BIN
      __snapshots__/repo-header--no-name.png
  3. 2
      __snapshots__/repo-header.test.js.snap
  4. 9
      src/lib/components/RepoSummaryCard.svelte
  5. 9
      src/lib/components/repo/RepoHeader.svelte

BIN
__snapshots__/repo-header--long-name.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 15 KiB

BIN
__snapshots__/repo-header--no-name.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 17 KiB

2
__snapshots__/repo-header.test.js.snap

@ -18,7 +18,7 @@ exports[`Repo/Header No Name smoke-test 1`] = ` @@ -18,7 +18,7 @@ exports[`Repo/Header No Name smoke-test 1`] = `
<a href="/repo/9ee507fc4357d7ee16a5d8901bedcd103f23c17d"
class="strong btn btn-ghost mb-0 mt-0 break-words px-3 text-sm"
>
Untitled
9ee507fc4357d7ee16a5d8901bedcd103f23c17d
</a>
</div>
</div>

9
src/lib/components/RepoSummaryCard.svelte

@ -6,9 +6,12 @@ @@ -6,9 +6,12 @@
summary_defaults
let short_name: string
$: {
if (name.length > 45) short_name = name.slice(0, 45) + '...'
else if (name.length == 0) short_name = 'Untitled'
else short_name = name
if (name && name.length > 45) short_name = name.slice(0, 45) + '...'
else if (name && name.length >= 0) short_name = name
else if (identifier && identifier.length > 45)
short_name = identifier.slice(0, 45) + '...'
else if (identifier && identifier.length >= 0) short_name = identifier
else short_name = 'Untitled'
}
$: short_descrption =
description.length > 50 ? description.slice(0, 45) + '...' : description

9
src/lib/components/repo/RepoHeader.svelte

@ -19,9 +19,12 @@ @@ -19,9 +19,12 @@
} = event_defaults
let short_name: string
$: {
if (name.length > 45) short_name = name.slice(0, 45) + '...'
else if (name.length == 0) short_name = 'Untitled'
else short_name = name
if (name && name.length > 45) short_name = name.slice(0, 45) + '...'
else if (name && name.length >= 0) short_name = name
else if (identifier && identifier.length > 45)
short_name = identifier.slice(0, 45) + '...'
else if (identifier && identifier.length >= 0) short_name = identifier
else short_name = 'Untitled'
}
</script>

Loading…
Cancel
Save