jsem / mtg-life-counter

A personalised life counter for mtg
0 stars 0 forks source link

Create profile reducer #4

Closed jsem closed 6 years ago

jsem commented 6 years ago

create the profile reducer and associated actions. local storage functionality should be implemented in issue #5, this ticket is just for implementing the state modifying components

designs are as below: image

state should initialise to an array/map of all saved profiles from local storage

actions as shown. CREATE_PROFILE simply takes in a profile ID. this is invoked when you press the "create new profile" button and will create a new profile with default settings. should save to local storage UPDATE_PROFILE takes in a json object containing the profile values to update and the ID of the profile we wish to update. this is called either whenever we change the profile in the profile editor, or when the save button is clicked. use your discretion to determine what is the more intuitive functionality (i.e. will players want to exit without saving? if so dont update the profile every time something changes, only when save is pressed). should save to local storage DELETE_PROFILE takes in the ID of the profile to delete and remove from local storage

jsem commented 6 years ago

also look into how we want to save the images for the profile background. do we save an image to local storage and then simply save a file URL to the profile? or do we save like an encoded image string that then gets read and displayed?

jsem commented 6 years ago

added tests