Coder Social home page Coder Social logo

apollographql / spotify-showcase Goto Github PK

View Code? Open in Web Editor NEW
110.0 7.0 14.0 6.6 MB

A Spotify clone that showcases the Apollo GraphQL platform.

License: MIT License

TypeScript 98.70% HTML 0.12% SCSS 0.02% JavaScript 0.43% CSS 0.21% MDX 0.05% Dockerfile 0.09% Shell 0.38%
apollo-client apollo-graphql apollo-server graphql

spotify-showcase's Issues

Add some basic CI

Because this is an full running app that we expect people to try running themselves, it would do us well to ensure PRs don't completely break the app. We should add some basic CI that runs when a PR is opened to ensure some basic requirements are met:

  • The CLA has been accepted
  • ESLint rules pass
  • Tests pass

Feedback wanted!

If you used the React + Apollo Spotify Showcase and have two minutes then we'd really appreciate it if you filled out this survey - it really helps us improve!

Add the ability to like/unlike tracks

To show off mutations, we should add the ability to like and unlike tracks. This is done in the Spotify app using the ❤️ icon. The UI should also show which tracks are liked by the user throughout the application.

Dedupe subscriptions based on Spotify User ID

If a user opens up more than one window of the client app, we make N number of observables. Ideally we are storing these observables based on the unique Spotify id and that would dedupe subscriptions requests for the same user.

Add pagination

Many pages show a list of paginated content, but currently nothing else has the ability to load more of it. Let's make it possible to load more content for the various pages (playlists, saved tracks, etc)

Improve empty state on Search page

CleanShot 2023-07-19 at 16 06 19

On the web, the empty search page displays a colorful grid of genres. Would be a nice improvement over the current (simple) empty state!

Show the currently playing track or podcast episode

To really make the demo pop, it would be nice to show the currently playing track or podcast episode. This would include the play/pause button, shuffle, repeat, prev/next, and the progress bar.

We have 2 ways we can accomplish getting the playback state:

  1. Use the web playback SDK

This is Spotify's official SDK for handling real-time playback state. This also registers a device that can be targeted by any Spotify player to play through the app itself. This would make for a nicer UX, but forgoes the change for us to show off the possibility of using Apollo Client for real-time UX using subscriptions.

  1. Build our own subscription that targets the Spotify API to get playback state.

Using our own API would be a great way to show off how to use a websocket connection and subscriptions with Apollo Client, with the expense of the nice UX built into the web playback SDK. This might also not allow us to register the app as a playback target. The API however has all we need to control playback, so this could be a great mechanism to demonstrate subscriptions.

Implement the queue page

https://open.spotify.com/queue

Add the ability to view the user's queue.

Tasks

Limitations:

Unfortunately the Spotify API makes it impossible to determine when a user has added an item to the queue via the "add to queue" button. In Spotify's UI, this shows up in its own "Next in queue" section since tracks added in this manner "interrupt" the current flow of songs (such as playing an album). We will only be able to show the "currently playing" and next set of tracks.

Determine if the app can run in CodeSandbox

It would be beneficial to see if we can run the app in CodeSandbox. This would be a great way to share the app with developers as a means to be able to play around with the app without needing to clone it first.

Add more content to home page

The home page currently shows a list of 10 recommended playlists, but thats it. Let's spruce it up some more and add more content closer to what the actual Spotify home page looks like.

Determine how to handle free users

Spotify only allows Premium users to control playback via their Spotify Connect API. The app is only built to handle premium users as of right now, so we need to determine how best to handle this.

Some ideas:

  • Remove the playbar entirely
  • Disable all playback controls (we can still get playback state, even if it can't be controlled)

Better error pages

The error pages have little to no styling. We should spruce these up a bit to look a nicer.

Add dropdown menus for albums

When viewing an album page, a dropdown menu is presented to the user next to the heart icon with relevant actions. Add the dropdown menu and hook up the actions. Actions that can be performed with the available APIs:

  • Add to queue
  • Add to Your Library
  • Add to playlist
  • Share -> Copy Album link

Add dropdown menus for tracks

While the app allows the user to use a context menu to perform actions on a track, a dropdown menu should also be available to perform relevant actions. Tracks in different context (albums, playlists, etc) should be presented with relevant options for that context. Actions that should be added given the available APIs include:

Tracks in an album

  • Add to queue
  • Go to artist
  • Go to album
  • Save / Remove from your Liked Songs
  • Add to playlist
  • Share -> Copy song link
  • Open in desktop app

Tracks in an artist's top tracks

  • Add to queue
  • Go to album
  • Save / Remove from your Liked Songs
  • Add to playlist
  • Share -> Copy song link
  • Open in desktop app

Tracks in a playlist

  • Add to queue
  • Go to artist
  • Go to album
  • Save / remove from your Liked Songs
  • Add to playlist
  • Remove from this playlist (when the user own's the playlist)
  • Share -> Copy song link
  • Open in desktop app

Update page title and favicon

The existing app uses the Create React App default with "React app" and the React logo. Let's update this to be a bit more official.

Script to recreate the graph in GraphOS should log helpful message output

Currently, the script to recreate the graph in GraphOS (scripts/demo.ts) doesn't output anything. I was left wondering if the script worked or not.

Ideally, we should have:

  • logs for each step the script is running, so we can track where it might fail
  • if successful, log a message with a link to the graph in Studio for easy access

Add some tests for the app

In a haste to get this demo up and running, I've ignored testing many aspects of this app.

Testing is a huge part of development on any app with Apollo Client. We want to be able to effectively demonstrate useful testing with Apollo Client. We should therefore be good citizens and provide some tests to demonstrate how we think about it.

Having some tests will also be useful when we are ready to execute on apollographql/apollo-client#9738 as we'll be able to see if our new approach feels right.

Add SSR

The app is currently split up between front/back ends running on different ports. To properly demo SSR and the new React 18 features, we need to ensure the app is running SSR.

Switch all CSS over to Tailwind.css

I started this application using CSS modules which provided a great starting point. Over time I decided to pull in Tailwind CSS which is now the de facto way to style everything in the app.

Because of this, styles are now fragmented between the two approaches. I'd really like to remove all the initial CSS module code and replace it with tailwind styles to ensure the CSS solution is consistent everywhere.

To accomplish this, simply search for all files with a .module.scss extension. These CSS files should match the .tsx filename they are imported in, so find the areas in which these styles are imported and replace with the tailwind equivalents.

Add an app/technical settings page

One of the aspects of the demo is the ability to add synthetic timeouts and errors for any field in the schema when querying the GraphQL server. To add a timeout or error, this requires opening up the GraphiQL page and running a mutation. We should make this easier to configure by adding a page in the app to easily define these synthetic timeouts and errors.

Finish the artist page

Much of the artist page is implemented, however there is still some missing functionality

Tasks

Add notifications using local state/reactive vars

Some actions (like liking/unliking a track) will show a notification in the UI to confirm the action was successful. Let's implement something similar and use it as an opportunity to demonstrate the use of reactive vars/client state.

Implement the "Your Episodes" page

https://open.spotify.com/collection/episodes

Tasks

Create an error boundary for page-specific errors

When an error is thrown on a particular page, the error bubbles up to the root error boundary, which removes all the app chrome.

Screenshot 2023-02-13 at 6 02 34 PM

For a better experience, errors thrown on page renders should only bubble up to the page's nearest <Outlet />. This should allow the app to continue displaying the app's chrome while showing the error message. This will allow the user to navigate to other parts of the app without being completely blocked.

Add contextual information/help

The Spotify demo can be a great resource for learning various aspects of Apollo client and how it can be used for a complex application. Adding a first-class resource in the demo to discuss how the code is constructed and giving tips on how to play around with the code will be super helpful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.