Skip to content

Commit

Permalink
about and music routes now load with spinners, as well as the compone…
Browse files Browse the repository at this point in the history
…nts they load
  • Loading branch information
michaelchadwick committed Jun 6, 2024
1 parent 917c9a1 commit b43c214
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
{{#if @commits}}
<ul>
{{#each @commits as |commit|}}
<li>
{{commit.commit.author.date}} -
<a href={{commit.html_url}} target="_blank" rel="noopener noreferrer">
{{commit.commit.message}}
</a>
</li>
<li>
{{commit.commit.author.date}} -
<a href={{commit.html_url}} target="_blank" rel="noopener noreferrer">
{{commit.commit.message}}
</a>
</li>
{{/each}}
</ul>
{{else}}
{{else}}
<p>{{t "general.noneFound" items="commits"}}</p>
{{/if}}
{{/if}}
</div>
File renamed without changes.
8 changes: 8 additions & 0 deletions app/components/gh-commits/loading.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="gh-commits-loading">
<h3>{{if @title @title (t "components.headGhCommits")}}</h3>
{{#if @commits}}
<p>{{t "general.loading" items="commits"}}</p>
{{else}}
<p>{{t "general.noneFound" items="commits"}}</p>
{{/if}}
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if this.currentlyLoading}}
{{t "general.loading"}}
{{t "general.loading" items="songs"}}
{{else}}
{{#if @songs}}
<ul class="song-list">
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions app/components/song-list/loading.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<FaIcon @icon="spinner" @spin={{true}} />{{t "general.loading"}}
5 changes: 0 additions & 5 deletions app/routes/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ export default class AboutRoute extends Route {
const response = await fetch(url);
const commits = await response.json();

console.log(
'commits',
commits.map((c) => c.commit),
);

return commits;
}

Expand Down
5 changes: 4 additions & 1 deletion app/templates/about-loading.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<h2>{{t "layout.headAbout"}}</h2>
<p>{{t "sections.about.description" htmlSafe=true}}</p>

<div class="loading-spinner">
{{t "general.loading"}}
<FaIcon @icon="spinner" @spin={{true}} />{{t "general.loading"}}
</div>
5 changes: 3 additions & 2 deletions app/templates/about.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<h2>{{t "layout.headAbout"}}</h2>
{{t "sections.about.description" htmlSafe=true}}

{{#if this.isLoading}}
{{t "general.loading"}}
<GhCommits::Loading />
{{else}}
<GhCommits
<GhCommits
@title="Last 5 Commits"
@commits={{@model}}
/>
Expand Down
5 changes: 4 additions & 1 deletion app/templates/music-loading.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<h2>{{t "layout.headMusic"}}</h2>
<p>{{t "sections.music.description" htmlSafe=true}}</p>

<div class="loading-spinner">
{{t "general.loading"}}
<FaIcon @icon="spinner" @spin={{true}} />{{t "general.loading"}}
</div>
2 changes: 1 addition & 1 deletion app/templates/music.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h2>{{t "layout.headMusic"}}</h2>
<p>{{t "sections.music.description"}}</p>
{{#if this.isLoading}}
{{t "general.loading"}}
<SongList::Loading />
{{else}}
<SongList @songs={{@model}} />
{{/if}}
1 change: 1 addition & 0 deletions config/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = function () {
'pause',
'play',
'square-up-right',
'spinner',
],
'free-brands-svg-icons': ['github'],
};
Expand Down

0 comments on commit b43c214

Please sign in to comment.