mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
Add prettier for codestyle and re-format everything (#1294)
This commit is contained in:
parent
8b78154075
commit
0aae1f70d2
319 changed files with 4809 additions and 3936 deletions
|
@ -17,7 +17,13 @@ import { IconName } from '../../components/common/fork-awesome/types'
|
|||
|
||||
export const DEFAULT_DURATION_IN_SECONDS = 10
|
||||
|
||||
export const dispatchUiNotification = (title: string, content: string, durationInSecond = DEFAULT_DURATION_IN_SECONDS, icon?: IconName, buttons?: UiNotificationButton[]): void => {
|
||||
export const dispatchUiNotification = (
|
||||
title: string,
|
||||
content: string,
|
||||
durationInSecond = DEFAULT_DURATION_IN_SECONDS,
|
||||
icon?: IconName,
|
||||
buttons?: UiNotificationButton[]
|
||||
): void => {
|
||||
store.dispatch({
|
||||
type: UiNotificationActionType.DISPATCH_NOTIFICATION,
|
||||
notification: {
|
||||
|
@ -39,7 +45,9 @@ export const dismissUiNotification = (notificationId: number): void => {
|
|||
} as DismissUiNotificationAction)
|
||||
}
|
||||
|
||||
export const showErrorNotification = (message: string) => (error: Error): void => {
|
||||
console.error(message, error)
|
||||
dispatchUiNotification(i18n.t('common.errorOccurred'), message, DEFAULT_DURATION_IN_SECONDS, 'exclamation-triangle')
|
||||
}
|
||||
export const showErrorNotification =
|
||||
(message: string) =>
|
||||
(error: Error): void => {
|
||||
console.error(message, error)
|
||||
dispatchUiNotification(i18n.t('common.errorOccurred'), message, DEFAULT_DURATION_IN_SECONDS, 'exclamation-triangle')
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
||||
import { Reducer } from 'redux'
|
||||
import {
|
||||
DismissUiNotificationAction,
|
||||
|
@ -14,7 +13,10 @@ import {
|
|||
UiNotificationState
|
||||
} from './types'
|
||||
|
||||
export const UiNotificationReducer: Reducer<UiNotificationState, UiNotificationAction> = (state: UiNotificationState = [], action: UiNotificationAction) => {
|
||||
export const UiNotificationReducer: Reducer<UiNotificationState, UiNotificationAction> = (
|
||||
state: UiNotificationState = [],
|
||||
action: UiNotificationAction
|
||||
) => {
|
||||
switch (action.type) {
|
||||
case UiNotificationActionType.DISPATCH_NOTIFICATION:
|
||||
return state.concat((action as DispatchUiNotificationAction).notification)
|
||||
|
@ -25,7 +27,10 @@ export const UiNotificationReducer: Reducer<UiNotificationState, UiNotificationA
|
|||
}
|
||||
}
|
||||
|
||||
const dismissNotification = (notificationState: UiNotificationState, notificationIndex: number): UiNotificationState => {
|
||||
const dismissNotification = (
|
||||
notificationState: UiNotificationState,
|
||||
notificationIndex: number
|
||||
): UiNotificationState => {
|
||||
const newArray = [...notificationState]
|
||||
const oldNotification = newArray[notificationIndex]
|
||||
newArray[notificationIndex] = {
|
||||
|
|
|
@ -14,7 +14,7 @@ export enum UiNotificationActionType {
|
|||
}
|
||||
|
||||
export interface UiNotificationButton {
|
||||
label: string,
|
||||
label: string
|
||||
onClick: () => void
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue