turbowookie / turbo-wookie

Turbo Wookie Project. Because Turbo Wookie
http://turbowookie.github.io
BSD 3-Clause "New" or "Revised" License
9 stars 2 forks source link

New frontend #34

Closed mpeterson2 closed 10 years ago

mpeterson2 commented 10 years ago

New Frontend

So I decided to redo the frontend. There's a lot of different code, but a lot of reused code as well. I took more advantage of Polymer and some more Dart features as well that I didn't know about before this. For an example, getting the playlist is much simpler for the Dart code, but slightly more complex for the html stuff. I tried to make it as similar to our old stuff as possible, while adding in some new/different stuff that I wanted to add before as well.

New/Different stuff

Hopefully I can explain this well...

Folder hierarchy

So our file hierarchy now looks like this (If this doesn't make sense, you can look at it on github):

├──pubspec.lock - Info about our dependencies.
├──pubspec.yaml - Includes our info about our application.
├──build.dart - Gives us info about Polymer errors and stuffs for the Dart editor.
├──build - Our files build to this folder.
  ├──web - Our files actually build to this folder.
├──web - Where our important files are.
  ├──index.html - Our very simple index page.
  ├──style.css - Our once again, very simple css file.
  ├──img - Image files used in our html
  ├──classes - Non-Polymer dart files go here.
  ├──components - Polymer files
    ├──css -  Polymer css files
    ├──dart - Polymer dart files
    ├──html - Polymer html files
    ├──img - Image files used in our html

The files!

I'll try to explain all the files as best as I can, but no promises.

web/

This is where the not really needed for Turbo Wookie files, but needed to run an application files are.

index.html

This file is very simple. It's just a basic html file that imports our main polymer element, initializes polymer and displays everything.

style.css

This basically just gives style to the body.

main.dart

This has been migrated into the index file since I wrote this. All this does is initialize polymer, and could probably be replaced by a simple script in the index. Maybe later?

classes/

This is where all non-polymer dart files are.

lastfm.dart

This just gathers info from lastfm. I decided to give it it's own file so it'd be easier to change it to a different service if we wanted to.

song.dart

This is the same as the old song.dart. It

This is where all the Polymer stuff is. It's separated in folders: css, dart, and html, but I'm going to talk about them as one component. I'll mostly talk about the Dart stuff, cause that's the most interesting.

All components are named tw-name in html and just name in Dart. This is because Polymer requires a - in an element.

library

This file holds our library stuff. It's the same as library-list in the old version, except it no longer includes the views buttons.

player

This is the new media-bar. It's pretty much the exact same thing.

playlist

This is the new play-list. It's looks like it's pretty much the same, but it's a little simpler.

The html part takes over a bit of what the dart code did. It takes advantage of html templates, and Polymer's @observable annotation. The html observes a list and automagically adds the songs to the playlist.

The current playing song is no longer part of the list of songs, so it stays at the top instead of scrolling.

turbo-wookie

This is the main component of our application. It just puts everything together and doesn't do much else. You can actually create multiple <tw-turbo-wookie> tags, and it will be on the page twice. The player is always at the bottom of the screen and taking up the whole thing, but it's pretty cool that you can do that.

views

This is the buttons for the artists/albums/songs tabs. It's it's own component so it will stay over the library when you scroll. It also now updates when you navigate to a different view outside of clicking a views button.

Further things to do (related to the new frontend)

I think I went over this pretty well. If you are still confused, post a comment and I'll think about answering. I'm open to renaming/reorganizing. I'm especially still iffy the classes folder name if there's a better one. Other than that I think everything is good.

sleepdeprecation commented 10 years ago

:+1: