Skip to content

sample state

Phillip edited this page Dec 9, 2019 · 12 revisions

Sample State

{
  "entities": {
    "servers": {
      "1": {
        "id": 1,
        "name": "Programming Hangout",
        "description": "Lorem ipsum",
        "ownerId": 1,
        "isPrivate": false,
        "inviteToken": "aB4fwqVzg",
        "channelIds": [1, 2, 4],
        "userIds": [1, 2, 3]
      },
      "2": {
        "id": 2,
        "name": "Memes",
        "description": "Lorem ipsum dolor",
        "ownerId": 3,
        "isPrivate": false,
        "inviteToken": "nbEr9Wqd",
        "channelIds": [3, 5],
        "userIds": [1, 3, 4, 5]
      }  
    },
    "users": {
      "1": {
        "id": 1,
        "username": "Doggyon",
        "imageUrl": "/images/avatars/1-aeFv43nwe.png"
      },
      "2": {
        "id": 2,
        "username": "Minimini",
        "imageUrl": "/images/avatars/2-b743HaAne.png"
      },
      "3": {
        "id": 3,
        "username": "Halfwynn",
        "imageUrl": "/images/avatars/3-weBaw42az.png"
      }
    },
    "channels": {
      "1": {
        "id": 1,
        "serverId": 1,
        "name": "general",
        "description": "Lorem ipsum",
        "messageIds": [1, 2, 4, 8]
      },
      "2": {
        "id": 2,
        "serverId": 1,
        "name": "ruby",
        "description": "Lorem ipsum dolorem",
        "messageIds": [3, 5, 11]
      },
      "4": {
        "id": 4,
        "serverId": 1,
        "name": "javascript",
        "description": "Lorem ipsum dolor",
        "messageIds": [6, 7, 10, 13]
      }
    },
    "messages": {
      "3": {
        "id": 3,
        "channelId": 2,
        "authorId": 2,
        "body": "I love rubies",
        "created_at": "2019-12-02 14:32:19.435"
      },
      "5": {
        "id": 5,
        "channelId": 2,
        "authorId": 1,
        "body": "You rube",
        "created_at": "2019-12-02 14:39:19.511"
      },
      "11": {
        "id": 11,
        "channelId": 2,
        "authorId": 3,
        "body": "lol",
        "created_at": "2019-12-02 14:41:19.757"
      },
    }
  },
  "ui": {
    "modal": {
      
    },
    "loading": false,
    "currentServer": 1,
    "currentChannel": 2,
    "onlineUsers": [2, 3]
  },
  "errors": {
    "session": [],
    "serverForm": [],
    "channelForm": [],
    "chat": []
  },
  "session": {
    "currentUserId": 2
  }
}

Notes

  • To save space, the entities in front end state will be limited to:
    • Servers of which the current user is a member
    • Channels in the current server
    • Messages in the current channel
    • Users that are members of the current server
  • Unsure whether currentServer and currentChannel belong under ui, entities, or some other key
  • Possible modal views:
    • Confirmation popup for joining a server
    • Confirmation popup for deleting a server/channel/message
    • User popup (with link to start a DM)
    • Message/channel context menu: Edit, Delete
    • Server context menu: Leave
    • Server/channel create/edit forms
    • Message edit form (alternative: edit messages in-line like the real Discord--might be a mini-bonus)
    • User context menu: Kick, Assign Role (bonuses only)
  • I haven't accounted for DMs yet
Clone this wiki locally