-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Design Review: Use Alert for Deploy error messages
- Loading branch information
1 parent
2730623
commit e49a2fc
Showing
5 changed files
with
82 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* @typedef {import("./typedefs").ErrorStateType} ErrorStateType | ||
* @typedef {import('../../components/Notifications/typedefs').NotificationConfig} NotificationConfig | ||
*/ | ||
|
||
/** | ||
* @param {ErrorStateType} type | ||
* @returns {NotificationConfig} Error Notification | ||
*/ | ||
export const getErrorNotification = (type) => { | ||
/** @type {NotificationConfig} */ | ||
const baseConfig = { | ||
id: type, | ||
blockTransition: true, | ||
type: "warning", | ||
}; | ||
|
||
switch (type) { | ||
case "MISSING_CONFIG_OBJECT": | ||
return { | ||
...baseConfig, | ||
message: { id: "deploy-error-message.missing-config-object" }, | ||
}; | ||
|
||
case "MISSING_CONFIG_VARIABLE": | ||
return { | ||
...baseConfig, | ||
message: { id: "deploy-error-message.missing-config-variable.intro" }, | ||
link: { | ||
label: { | ||
id: "deploy-error-message.missing-config-variable.link-text", | ||
}, | ||
url: "/settings/vercel-deploy", | ||
}, | ||
}; | ||
|
||
case "ERROR_AVAILABILITY": | ||
return { | ||
...baseConfig, | ||
message: { id: "deploy-error-message.error-availability" }, | ||
}; | ||
|
||
case "ERROR_FORBIDDEN": | ||
return { | ||
...baseConfig, | ||
message: { id: "deploy-error-message.error-forbidden" }, | ||
}; | ||
|
||
case "ERROR_DEPLOY": | ||
return { | ||
...baseConfig, | ||
message: { id: "deploy-error-message.error-deploy" }, | ||
}; | ||
|
||
default: | ||
return { | ||
...baseConfig, | ||
message: { id: "deploy-error-message.default" }, | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.