options.js 948 B

1234567891011121314151617181920212223242526272829303132
  1. // Commands
  2. export const commands = {
  3. 'DELETE_BLOG': 'DELETE_BLOG',
  4. 'EDIT_BLOG': 'EDIT_BLOG',
  5. 'TOGGLE_FEATURE': 'TOGGLE_FEATURE'
  6. }
  7. const createOption = (name, command) => ({name, command})
  8. // Options
  9. // Published Blogs
  10. const DELETE_BLOG = createOption('Delete Blog', commands.DELETE_BLOG)
  11. const EDIT_BLOG = createOption('Edit Blog', commands.EDIT_BLOG)
  12. const FEATURE_BLOG = createOption('Feature Blog', commands.TOGGLE_FEATURE)
  13. const UN_FEATURE_BLOG = createOption('Un-Feature Blog', commands.TOGGLE_FEATURE)
  14. // Options
  15. // Drafts Blogs
  16. const DELETE_DRAFT = createOption('Delete Draft', commands.DELETE_BLOG)
  17. const EDIT_DRAFT = createOption('Edit Draft', commands.EDIT_BLOG)
  18. export const createPublishedOptions = (isFeatured) => {
  19. const options = [EDIT_BLOG, DELETE_BLOG]
  20. isFeatured ? options.push(UN_FEATURE_BLOG) : options.push(FEATURE_BLOG)
  21. return options
  22. }
  23. export const createDraftsOptions = () => [EDIT_DRAFT, DELETE_DRAFT]