* Add the channel options to get into playbooks (#8750) * Add the channel options to get into playbooks * Use playbook run id instead of playbook id * i18n * Fix issues and move playbooks to the products folder * Address some tests * Fix test * Address design issues * Add requested comment --------- Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Playbooks database (#8802) * Add lastPlaybookFetchAt to channel table (#8916) * Add lastPlaybookFetchAt to channel table * Add missing commit * Use my_channel table instead * Fix test * Address feedback * First implementation of playbooks API (#8897) * First implementation of playbooks API * Add version check * Address feedback * Fix test * Add last fetch at usage and other improvements * Simplify test * Add sort_order, update_at and previousReminder columns (#8927) * Add sort_order, update_at and previousReminder columns * Remove order from the schema * Fix tests * Add tests * Add websockets for playbooks (#8947) * Add websocket events for playbooks * Fix typo * Add playbook run list (#8761) * Add the channel options to get into playbooks * Use playbook run id instead of playbook id * i18n * Fix issues and move playbooks to the products folder * Address some tests * Fix test * Add playbook run list * Add missing texts * Add back button support and item size to flash list * Address design issues * Add requested comment * Standardize tag and use it in the card * Fix merge * Add API related functionality --------- Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Add playbooks run details (#8872) * Add the channel options to get into playbooks * Use playbook run id instead of playbook id * i18n * Fix issues and move playbooks to the products folder * Address some tests * Fix test * Add playbook run list * Add missing texts * Add back button support and item size to flash list * Address design issues * Add requested comment * Standardize tag and use it in the card * Add playbooks run details * Fix merge * Add API related functionality * Add API related changes * Order fixes * Several fixes * Add error state on playbook run * i18n-extract * Fix tests * Fix test * Several fixes * Fixes and add missing UI elements * i18n-extract * Fix tests * Remove files from bad merge --------- Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Add missing tests for playbooks (#8976) * Add the channel options to get into playbooks * Use playbook run id instead of playbook id * i18n * Fix issues and move playbooks to the products folder * Address some tests * Fix test * Add playbook run list * Add missing texts * Add back button support and item size to flash list * Address design issues * Add requested comment * Standardize tag and use it in the card * Add playbooks run details * Fix merge * Add API related functionality * Add API related changes * Order fixes * Several fixes * Add error state on playbook run * i18n-extract * Fix tests * Fix test * Several fixes * Fixes and add missing UI elements * i18n-extract * Fix tests * Remove files from bad merge * Add tests * Fix typo * Add missing strings * Fix tests and skip some * Fix test * Fix typo --------- Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Address feedback * Address feedback and fix tests * Address comments and fix tests * Address feedback * Address plugin changes and fix bugs --------- Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
192 lines
5.1 KiB
TypeScript
192 lines
5.1 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {defineMessages, type MessageDescriptor} from 'react-intl';
|
|
|
|
import keyMirror from '@utils/key_mirror';
|
|
|
|
export const SNACK_BAR_TYPE = keyMirror({
|
|
ADD_CHANNEL_MEMBERS: null,
|
|
CODE_COPIED: null,
|
|
FAVORITE_CHANNEL: null,
|
|
FOLLOW_THREAD: null,
|
|
INFO_COPIED: null,
|
|
LINK_COPIED: null,
|
|
LINK_COPY_FAILED: null,
|
|
MESSAGE_COPIED: null,
|
|
MUTE_CHANNEL: null,
|
|
REMOVE_CHANNEL_USER: null,
|
|
TEXT_COPIED: null,
|
|
UNFAVORITE_CHANNEL: null,
|
|
UNMUTE_CHANNEL: null,
|
|
UNFOLLOW_THREAD: null,
|
|
CREATE_POST_ERROR: null,
|
|
CONNECTION_ERROR: null,
|
|
SCHEDULED_POST_CREATION_ERROR: null,
|
|
RESCHEDULED_POST: null,
|
|
DELETE_SCHEDULED_POST_ERROR: null,
|
|
PLAYBOOK_ERROR: null,
|
|
});
|
|
|
|
export const MESSAGE_TYPE = {
|
|
SUCCESS: 'success',
|
|
ERROR: 'error',
|
|
DEFAULT: 'default',
|
|
};
|
|
|
|
export type SnackBarConfig = {
|
|
message: MessageDescriptor;
|
|
iconName: string;
|
|
canUndo: boolean;
|
|
type?: typeof MESSAGE_TYPE[keyof typeof MESSAGE_TYPE];
|
|
};
|
|
|
|
const messages = defineMessages({
|
|
ADD_CHANNEL_MEMBERS: {
|
|
id: 'snack.bar.channel.members.added',
|
|
defaultMessage: '{numMembers, number} {numMembers, plural, one {member} other {members}} added',
|
|
},
|
|
CODE_COPIED: {
|
|
id: 'snack.bar.code.copied',
|
|
defaultMessage: 'Code copied to clipboard',
|
|
},
|
|
FAVORITE_CHANNEL: {
|
|
id: 'snack.bar.favorited.channel',
|
|
defaultMessage: 'This channel was favorited',
|
|
},
|
|
FOLLOW_THREAD: {
|
|
id: 'snack.bar.following.thread',
|
|
defaultMessage: 'Thread followed',
|
|
},
|
|
INFO_COPIED: {
|
|
id: 'snack.bar.info.copied',
|
|
defaultMessage: 'Info copied to clipboard',
|
|
},
|
|
LINK_COPIED: {
|
|
id: 'snack.bar.link.copied',
|
|
defaultMessage: 'Link copied to clipboard',
|
|
},
|
|
LINK_COPY_FAILED: {
|
|
id: 'gallery.copy_link.failed',
|
|
defaultMessage: 'Failed to copy link to clipboard',
|
|
},
|
|
MESSAGE_COPIED: {
|
|
id: 'snack.bar.message.copied',
|
|
defaultMessage: 'Text copied to clipboard',
|
|
},
|
|
MUTE_CHANNEL: {
|
|
id: 'snack.bar.mute.channel',
|
|
defaultMessage: 'This channel was muted',
|
|
},
|
|
REMOVE_CHANNEL_USER: {
|
|
id: 'snack.bar.remove.user',
|
|
defaultMessage: '1 member was removed from the channel',
|
|
},
|
|
TEXT_COPIED: {
|
|
id: 'snack.bar.text.copied',
|
|
defaultMessage: 'Copied to clipboard',
|
|
},
|
|
UNFAVORITE_CHANNEL: {
|
|
id: 'snack.bar.unfavorite.channel',
|
|
defaultMessage: 'This channel was unfavorited',
|
|
},
|
|
UNMUTE_CHANNEL: {
|
|
id: 'snack.bar.unmute.channel',
|
|
defaultMessage: 'This channel was unmuted',
|
|
},
|
|
UNFOLLOW_THREAD: {
|
|
id: 'snack.bar.unfollow.thread',
|
|
defaultMessage: 'Thread unfollowed',
|
|
},
|
|
PLAYBOOK_ERROR: {
|
|
id: 'snack.bar.playbook.error',
|
|
defaultMessage: 'Unable to perform action. Please try again later.',
|
|
},
|
|
});
|
|
|
|
export const SNACK_BAR_CONFIG: Record<string, SnackBarConfig> = {
|
|
ADD_CHANNEL_MEMBERS: {
|
|
message: messages.ADD_CHANNEL_MEMBERS,
|
|
iconName: 'check',
|
|
canUndo: false,
|
|
},
|
|
CODE_COPIED: {
|
|
message: messages.CODE_COPIED,
|
|
iconName: 'content-copy',
|
|
canUndo: false,
|
|
},
|
|
FAVORITE_CHANNEL: {
|
|
message: messages.FAVORITE_CHANNEL,
|
|
iconName: 'star',
|
|
canUndo: true,
|
|
},
|
|
FOLLOW_THREAD: {
|
|
message: messages.FOLLOW_THREAD,
|
|
iconName: 'check',
|
|
canUndo: true,
|
|
},
|
|
INFO_COPIED: {
|
|
message: messages.INFO_COPIED,
|
|
iconName: 'content-copy',
|
|
canUndo: false,
|
|
},
|
|
LINK_COPIED: {
|
|
message: messages.LINK_COPIED,
|
|
iconName: 'link-variant',
|
|
canUndo: false,
|
|
type: MESSAGE_TYPE.SUCCESS,
|
|
},
|
|
LINK_COPY_FAILED: {
|
|
message: messages.LINK_COPY_FAILED,
|
|
iconName: 'link-variant',
|
|
canUndo: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
MESSAGE_COPIED: {
|
|
message: messages.MESSAGE_COPIED,
|
|
iconName: 'content-copy',
|
|
canUndo: false,
|
|
},
|
|
MUTE_CHANNEL: {
|
|
message: messages.MUTE_CHANNEL,
|
|
iconName: 'bell-off-outline',
|
|
canUndo: true,
|
|
},
|
|
REMOVE_CHANNEL_USER: {
|
|
message: messages.REMOVE_CHANNEL_USER,
|
|
iconName: 'check',
|
|
canUndo: true,
|
|
},
|
|
TEXT_COPIED: {
|
|
message: messages.TEXT_COPIED,
|
|
iconName: 'content-copy',
|
|
canUndo: false,
|
|
type: MESSAGE_TYPE.SUCCESS,
|
|
},
|
|
UNFAVORITE_CHANNEL: {
|
|
message: messages.UNFAVORITE_CHANNEL,
|
|
iconName: 'star-outline',
|
|
canUndo: true,
|
|
},
|
|
UNMUTE_CHANNEL: {
|
|
message: messages.UNMUTE_CHANNEL,
|
|
iconName: 'bell-outline',
|
|
canUndo: true,
|
|
},
|
|
UNFOLLOW_THREAD: {
|
|
message: messages.UNFOLLOW_THREAD,
|
|
iconName: 'check',
|
|
canUndo: true,
|
|
},
|
|
PLAYBOOK_ERROR: {
|
|
message: messages.PLAYBOOK_ERROR,
|
|
iconName: 'alert-outline',
|
|
canUndo: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
};
|
|
|
|
export default {
|
|
SNACK_BAR_TYPE,
|
|
SNACK_BAR_CONFIG,
|
|
};
|