Skip to content

Commit

Permalink
Merge pull request #9 from maxence-charriere/add-stations
Browse files Browse the repository at this point in the history
Add radios
  • Loading branch information
maxence-charriere authored Sep 23, 2020
2 parents e8bd83c + 8db8ed1 commit 5c99bc7
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 16 deletions.
90 changes: 74 additions & 16 deletions bin/lofimusic/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func newChannelStore() *channelStore {

c := []channel{
{
Name: "ChilledCow - relax & study",
Name: "ChilledCow - Study girl",
ID: "5qap5aO4i9A",
Slug: "chilledcow",
SocialMedia: []link{
Expand Down Expand Up @@ -69,7 +69,7 @@ func newChannelStore() *channelStore {
},
},
{
Name: "ChilledCow - sleep & chill",
Name: "ChilledCow - Sleepy girl",
ID: "DWcJFNfaw9c",
Slug: "chilledcow2",
SocialMedia: []link{
Expand Down Expand Up @@ -104,7 +104,7 @@ func newChannelStore() *channelStore {
},
},
{
Name: "Chillhop Music - jazzy & hip hop",
Name: "Chillhop Music - Walking raccoon",
ID: "5yx6BWlEVcY",
Slug: "chillhopmusic",
SocialMedia: []link{
Expand Down Expand Up @@ -135,7 +135,7 @@ func newChannelStore() *channelStore {
},
},
{
Name: "Chillhop Music - study & relax",
Name: "Chillhop Music - Sleepy raccoon",
ID: "7NOSDKb0HlU",
Slug: "chillhopmusic2",
SocialMedia: []link{
Expand Down Expand Up @@ -220,7 +220,7 @@ func newChannelStore() *channelStore {
},
},
{
Name: "Homework Radio - relax & study",
Name: "Homework Radio - Roof girl",
ID: "ZYMuB9y549s",
Slug: "homeworkradio",
SocialMedia: []link{
Expand All @@ -247,7 +247,7 @@ func newChannelStore() *channelStore {
},
},
{
Name: "Homework Radio - chill & study & relax",
Name: "Homework Radio - Rainy window",
ID: "nMhua5LJRWg",
Slug: "homeworkradio2",
SocialMedia: []link{
Expand Down Expand Up @@ -275,12 +275,12 @@ func newChannelStore() *channelStore {
},
},
{
Name: "STEEZYASFUCK - sleep & study",
ID: "US6iyJKGNLI",
Name: "STEEZYASFUCK - Junky fluff",
ID: "ePXRyWgWkTE",
Slug: "steezyasfuck",
SocialMedia: []link{
{
URL: "https://youtu.be/US6iyJKGNLI",
URL: "https://youtu.be/ePXRyWgWkTE",
MediaSlug: "youtube",
},
{
Expand All @@ -303,7 +303,7 @@ func newChannelStore() *channelStore {
},
},
{
Name: "STEEZYASFUCK - coffee shop radio",
Name: "STEEZYASFUCK - Coffee shop radio",
ID: "-5KAN9_CzSA",
Slug: "steezyasfuck2",
SocialMedia: []link{
Expand Down Expand Up @@ -331,7 +331,7 @@ func newChannelStore() *channelStore {
},
},
{
Name: "the bootleg boy - sad & sleepy",
Name: "the bootleg boy - Smoking girl",
ID: "l7TxwBhtTUY",
Slug: "thebootlegboy",
SocialMedia: []link{
Expand Down Expand Up @@ -363,7 +363,7 @@ func newChannelStore() *channelStore {
},
},
{
Name: "Monstafluff Music",
Name: "Monstafluff Music - Spaceship girl",
ID: "pH3xU1YcjaA",
Slug: "monstafluffmusic",
SocialMedia: []link{
Expand All @@ -378,12 +378,12 @@ func newChannelStore() *channelStore {
},
},
{
Name: "Aviencloud - Easy N' Smooth Relaxing Music ",
ID: "bjZ_O1gWlx4",
Name: "Aviencloud - Beach girl",
ID: "uMaWlgkm6rk",
Slug: "aviencloud",
SocialMedia: []link{
{
URL: "https://youtu.be/bjZ_O1gWlx4",
URL: "https://youtu.be/uMaWlgkm6rk",
MediaSlug: "youtube",
},
{
Expand Down Expand Up @@ -413,7 +413,7 @@ func newChannelStore() *channelStore {
},
},
{
Name: "InYourChill - relax & study",
Name: "InYourChill - Nerdy girl",
ID: "B8tQ8RUbTW8",
Slug: "inyourchill",
SocialMedia: []link{
Expand Down Expand Up @@ -443,6 +443,64 @@ func newChannelStore() *channelStore {
},
},
},
{
Name: "College Music - Lonely girl",
ID: "bM0Iw7PPoU4",
Slug: "collegemusic",
SocialMedia: []link{
{
URL: "https://youtu.be/bM0Iw7PPoU4",
MediaSlug: "youtube",
},
{
URL: "https://www.facebook.com/collegemusic",
MediaSlug: "facebook",
},
{
URL: "https://open.spotify.com/playlist/6llX35G0q026dwt6HuX5or",
MediaSlug: "spotify",
},
{
URL: "https://www.instagram.com/collegemusic",
MediaSlug: "instagram",
},
{
URL: "https://twitter.com/collegemusicyt",
MediaSlug: "twitter",
},
{
URL: "https://discord.com/invite/collegemusic",
MediaSlug: "discord",
},
},
},
{
Name: "KozyPop - 같이해요",
ID: "F5v_VqxbQPI",
Slug: "kozypop",
SocialMedia: []link{
{
URL: "https://youtu.be/F5v_VqxbQPI",
MediaSlug: "youtube",
},
{
URL: "https://www.facebook.com/kozypop",
MediaSlug: "facebook",
},
{
URL: "https://open.spotify.com/playlist/7FF5lMMpCWJKHzbJk47Cnh?si=0GySMJBESb6Yc7Fj9JNgYA",
MediaSlug: "spotify",
},
{
URL: "https://www.instagram.com/kozypop",
MediaSlug: "instagram",
},
{
URL: "https://kozypop.com",
MediaSlug: "web",
},
},
},
}

sort.Slice(c, func(a, b int) bool {
Expand Down
13 changes: 13 additions & 0 deletions bin/lofimusic/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"net/url"

"github.com/maxence-charriere/go-app/v7/pkg/app"
)
Expand All @@ -12,6 +13,10 @@ type menu struct {
CurrentChannel channel
}

func (m *menu) OnNav(ctx app.Context, u *url.URL) {
app.Window().ScrollToID(m.CurrentChannel.ID)
}

func (m *menu) Render() app.UI {
chans := channels.Channels()

Expand All @@ -27,6 +32,7 @@ func (m *menu) Render() app.UI {
app.Range(chans).Slice(func(i int) app.UI {
c := chans[i]
return newMenuItem().
ID(c.ID).
Text(c.Name).
Selected(c.Slug == m.CurrentChannel.Slug).
Href("/" + c.Slug).
Expand Down Expand Up @@ -83,6 +89,7 @@ type menuItem struct {
Itext string
Ihelp string
Itarget string
Iid string
}

func newMenuItem() *menuItem {
Expand Down Expand Up @@ -121,8 +128,14 @@ func (i *menuItem) OpenAside() *menuItem {
return i
}

func (i *menuItem) ID(v string) *menuItem {
i.Iid = v
return i
}

func (i *menuItem) Render() app.UI {
return app.A().
ID(i.Iid).
Class("item").
Class(i.Iselected).
Href(i.Ihref).
Expand Down
Binary file modified docs/web/app.wasm
Binary file not shown.

0 comments on commit 5c99bc7

Please sign in to comment.