Adding a isblank check
All checks were successful
Music Collection CI Workflow / test (./backend) (push) Successful in 29s
Music Collection CI Workflow / test (./frontend) (push) Successful in 35s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/music-collection-backend, ./backend) (push) Successful in 50s
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Successful in 1m45s
Music Collection CI Workflow / deploy (push) Successful in 24s

This commit is contained in:
Phill Pover 2025-04-07 02:16:11 +01:00
parent 27be45b284
commit 5b6a6004da
3 changed files with 35 additions and 37 deletions

View File

@ -46,7 +46,7 @@ export default function Page() {
const formData = new FormData(event.currentTarget); const formData = new FormData(event.currentTarget);
try { try {
if (StringUtils.isBlank(formData.get('id'))) { if (StringUtils.isBlank(formData.get('id') as string)) {
const data = await createSong(formData); const data = await createSong(formData);
console.log(data); console.log(data);
} else { } else {
@ -108,41 +108,39 @@ export default function Page() {
return ( return (
<> <>
<div className="container"> <div className="container">
<div className="eight columns"> <div>
<div> <em>{album.title}</em> by {album.artist} ({album.genre})
<em>{album.title}</em> by {album.artist} ({album.genre})
</div>
<IconButton aria-label="Add Album" size="large" onClick={handleCreate}>
<AddCircleOutline fontSize="inherit" color="success"/>
</IconButton>
<table className="u-full-width">
<thead>
<tr>
<th>#</th>
<th>Title</th>
<th>Duration</th>
<th>Controls</th>
</tr>
</thead>
<tbody>
{album.songs.map((song: Song) => (
<tr key={song.id}>
<td>{song.trackNumber}</td>
<td>{song.title}</td>
<td>{TimeUtils.fancyTimeFormat(song.duration)}</td>
<td>
<IconButton aria-label="Edit Song" size="small" song-id={song.id.toString()} onClick={handleEdit}>
<Edit fontSize="inherit" color="success"/>
</IconButton>
<IconButton aria-label="Delete Song" size="small" song-id={song.id.toString()} onClick={handleDelete}>
<Delete fontSize="inherit" color="success"/>
</IconButton>
</td>
</tr>
))}
</tbody>
</table>
</div> </div>
<IconButton aria-label="Add Album" size="large" onClick={handleCreate}>
<AddCircleOutline fontSize="inherit" color="success"/>
</IconButton>
<table className="u-full-width">
<thead>
<tr>
<th>#</th>
<th>Title</th>
<th>Duration</th>
<th>Controls</th>
</tr>
</thead>
<tbody>
{album.songs.map((song: Song) => (
<tr key={song.id}>
<td>{song.trackNumber}</td>
<td>{song.title}</td>
<td>{TimeUtils.fancyTimeFormat(song.duration)}</td>
<td>
<IconButton aria-label="Edit Song" size="small" song-id={song.id.toString()} onClick={handleEdit}>
<Edit fontSize="inherit" color="success"/>
</IconButton>
<IconButton aria-label="Delete Song" size="small" song-id={song.id.toString()} onClick={handleDelete}>
<Delete fontSize="inherit" color="success"/>
</IconButton>
</td>
</tr>
))}
</tbody>
</table>
</div> </div>
<Modal <Modal

View File

@ -40,7 +40,7 @@ export default function Page() {
const formData = new FormData(event.currentTarget); const formData = new FormData(event.currentTarget);
try { try {
if (StringUtils.isBlank(formData.get('id'))) { if (StringUtils.isBlank(formData.get('id') as string)) {
const data = await createAlbum(formData); const data = await createAlbum(formData);
console.log(data); console.log(data);
} else { } else {

View File

@ -1,5 +1,5 @@
export class StringUtils { export class StringUtils {
static isBlank(str) { static isBlank(str: string) {
return (!str || /^\s*$/.test(str)); return (!str || /^\s*$/.test(str));
} }
} }