diff --git a/app.go b/app.go index d5d9339..cba1dda 100644 --- a/app.go +++ b/app.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/tylertravisty/go-utils/random" - rumblelivestreamlib "github.com/tylertravisty/rumble-livestream-lib-go" ) // App struct @@ -35,15 +34,15 @@ func (a *App) Greet(name string) string { return fmt.Sprintf("Hello %s, It's show time!", random) } -func (a *App) QueryAPI(url string) (*rumblelivestreamlib.Followers, error) { - fmt.Println("QueryAPI") - client := rumblelivestreamlib.Client{StreamKey: url} - resp, err := client.Request() - if err != nil { - // TODO: log error - fmt.Println("client.Request err:", err) - return nil, fmt.Errorf("API request failed") - } +// func (a *App) QueryAPI(url string) (*rumblelivestreamlib.Followers, error) { +// fmt.Println("QueryAPI") +// client := rumblelivestreamlib.Client{StreamKey: url} +// resp, err := client.Request() +// if err != nil { +// // TODO: log error +// fmt.Println("client.Request err:", err) +// return nil, fmt.Errorf("API request failed") +// } - return &resp.Followers, nil -} +// return &resp.Followers, nil +// } diff --git a/frontend/src/assets/icons/gear.png b/frontend/src/assets/icons/gear.png new file mode 100644 index 0000000..c192495 Binary files /dev/null and b/frontend/src/assets/icons/gear.png differ diff --git a/frontend/src/assets/icons/hand-thumbs-down.png b/frontend/src/assets/icons/hand-thumbs-down.png new file mode 100644 index 0000000..27eace7 Binary files /dev/null and b/frontend/src/assets/icons/hand-thumbs-down.png differ diff --git a/frontend/src/assets/icons/hand-thumbs-up.png b/frontend/src/assets/icons/hand-thumbs-up.png new file mode 100644 index 0000000..75eddf3 Binary files /dev/null and b/frontend/src/assets/icons/hand-thumbs-up.png differ diff --git a/frontend/src/assets/icons/heart-fill.png b/frontend/src/assets/icons/heart-fill.png new file mode 100644 index 0000000..293d511 Binary files /dev/null and b/frontend/src/assets/icons/heart-fill.png differ diff --git a/frontend/src/assets/icons/house.png b/frontend/src/assets/icons/house.png new file mode 100644 index 0000000..982d5ea Binary files /dev/null and b/frontend/src/assets/icons/house.png differ diff --git a/frontend/src/assets/icons/index.jsx b/frontend/src/assets/icons/index.jsx index c4c8028..e506d73 100644 --- a/frontend/src/assets/icons/index.jsx +++ b/frontend/src/assets/icons/index.jsx @@ -1,5 +1,21 @@ import eye from './eye.png'; import eye_slash from './eye-slash.png'; +import gear from './gear.png'; +import heart from './heart-fill.png'; +import house from './house.png'; +import pause from './pause-fill.png'; +import play from './play-fill.png'; +import star from './star-fill.png'; +import thumbs_down from './hand-thumbs-down.png'; +import thumbs_up from './hand-thumbs-up.png'; export const Eye = eye; export const EyeSlash = eye_slash; +export const Gear = gear; +export const Heart = heart; +export const House = house; +export const Pause = pause; +export const Play = play; +export const Star = star; +export const ThumbsDown = thumbs_down; +export const ThumbsUp = thumbs_up; diff --git a/frontend/src/assets/icons/pause-circle.png b/frontend/src/assets/icons/pause-circle.png new file mode 100644 index 0000000..686a73d Binary files /dev/null and b/frontend/src/assets/icons/pause-circle.png differ diff --git a/frontend/src/assets/icons/pause-fill.png b/frontend/src/assets/icons/pause-fill.png new file mode 100644 index 0000000..a54d600 Binary files /dev/null and b/frontend/src/assets/icons/pause-fill.png differ diff --git a/frontend/src/assets/icons/play-circle.png b/frontend/src/assets/icons/play-circle.png new file mode 100644 index 0000000..def567b Binary files /dev/null and b/frontend/src/assets/icons/play-circle.png differ diff --git a/frontend/src/assets/icons/play-fill.png b/frontend/src/assets/icons/play-fill.png new file mode 100644 index 0000000..2cbb56c Binary files /dev/null and b/frontend/src/assets/icons/play-fill.png differ diff --git a/frontend/src/assets/icons/star-fill.png b/frontend/src/assets/icons/star-fill.png new file mode 100644 index 0000000..3478d59 Binary files /dev/null and b/frontend/src/assets/icons/star-fill.png differ diff --git a/frontend/src/components/Highlight.css b/frontend/src/components/Highlight.css new file mode 100644 index 0000000..8a67f50 --- /dev/null +++ b/frontend/src/components/Highlight.css @@ -0,0 +1,24 @@ +.highlight { + align-items: start; + color: white; + display: flex; + background-color: #75a54b; + border-radius: 0.5rem; + flex-direction: column; + font-family: sans-serif; + font-weight: bold; + height: 40px; + justify-content: center; + min-width: 90px; + padding: 5px 10px; + width: 75px; +} + +.highlight-value { + font-family: monospace; + font-size: 20px; +} + +.highlight-description { + font-size: 12px; +} \ No newline at end of file diff --git a/frontend/src/components/Highlight.jsx b/frontend/src/components/Highlight.jsx new file mode 100644 index 0000000..5d355ca --- /dev/null +++ b/frontend/src/components/Highlight.jsx @@ -0,0 +1,74 @@ +import './Highlight.css'; + +function Highlight(props) { + const countString = () => { + switch (true) { + case props.value <= 0: + return '-'; + case props.value < 1000: + return props.value; + case props.value < 1000000: + return (props.value / 1000).toFixed(3).slice(0, -2) + 'K'; + case props.value < 1000000000: + return (props.value / 1000000).toFixed(6).slice(0, -5) + 'M'; + default: + return 'Inf'; + } + }; + + const stopwatchString = () => { + console.log(props.value); + if (isNaN(Date.parse(props.value))) { + return '--:--'; + } + let now = new Date(); + let date = new Date(props.value); + console.log(date); + let diff = now - date; + + let msMinute = 1000 * 60; + let msHour = msMinute * 60; + let msDay = msHour * 24; + + let days = Math.floor(diff / msDay); + let hours = Math.floor((diff - days * msDay) / msHour); + let minutes = Math.floor((diff - days * msDay - hours * msHour) / msMinute); + + if (diff >= 100 * msDay) { + return days + 'd'; + } + if (diff >= msDay) { + return days + 'd ' + hours + 'h'; + } + + if (hours < 10) { + hours = '0' + hours; + } + + if (minutes < 10) { + minutes = '0' + minutes; + } + + return hours + ':' + minutes; + }; + + const valueString = () => { + switch (props.type) { + case 'count': + return countString(); + case 'stopwatch': + return stopwatchString(); + default: + return props.value; + } + }; + + return ( +