-
Notifications
You must be signed in to change notification settings - Fork 110
Release: v3.10.2 #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release: v3.10.2 #501
Changes from all commits
ef9afa8
9fdad70
3a3569b
a26b66e
1ad7bb3
6f1b898
61bb492
4733a0f
2f0981b
c04f347
0e0d11b
bfd57dc
5693475
73c821a
2b2ade1
472cbc4
8bca49c
c9d953a
b977c7e
419a2fc
ad76f5f
b70f723
3dfa23f
f2970e6
5e9f291
5ea86b2
af4e34e
1da40c2
badcd36
847667c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react' | |
| import { __ } from '@wordpress/i18n' | ||
| import { createInterpolateElement } from '@wordpress/element' | ||
| import { fetchConstQueryParam, fetchQueryParam, updateQueryParams } from '../../utils/urls' | ||
| import { DismissibleNotice } from '../common/Notice' | ||
| import { DismissibleNotice, type NoticeType } from '../common/Notice' | ||
| import { SUBPAGES, Toolbar } from '../common/Toolbar' | ||
| import { UpsellPage } from '../common/UpsellDialog' | ||
| import { CommunityCloud } from './CommunityCloud/CommunityCloud' | ||
|
|
@@ -24,31 +24,46 @@ const repositionTableOptionsSettings = () => { | |
| } | ||
| } | ||
|
|
||
| const getNoticeText = (result: string) => { | ||
| const getNotice = (result: string): { text: string, type: NoticeType } | undefined => { | ||
| switch (result) { | ||
| case 'deleted': | ||
| return __('Snippet <strong>deleted</strong>.', 'code-snippets') | ||
| return { text: __('Snippet <strong>deleted</strong>.', 'code-snippets'), type: 'success' } | ||
|
|
||
| case 'executed': | ||
| return { text: __('Snippet <strong>executed</strong>.', 'code-snippets'), type: 'success' } | ||
|
|
||
| case 'run-once-failed': | ||
| return { | ||
| text: __('The snippet could not be run. Check that its code is valid and try again.', 'code-snippets'), | ||
| type: 'error' | ||
| } | ||
|
|
||
| case 'run-once-safe-mode': | ||
| return { | ||
| text: __('Safe mode is active, so the snippet was not run.', 'code-snippets'), | ||
| type: 'warning' | ||
| } | ||
|
Comment on lines
+41
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Add a safe-mode notice test. In As per coding guidelines, keep TypeScript changes tested using existing AAA conventions. As per path instructions, ask for a test when the PR adds a branch and code has no runnable check. 🤖 Prompt for AI AgentsSources: Coding guidelines, Path instructions |
||
|
|
||
| default: | ||
| return undefined | ||
| } | ||
| } | ||
|
|
||
| const PageNotices = () => { | ||
| const [noticeText, setNoticeText] = useState(() => { | ||
| const [notice, setNotice] = useState(() => { | ||
| const result = fetchQueryParam('result') | ||
| updateQueryParams({ result: undefined }) | ||
| return result && getNoticeText(result) | ||
| return result ? getNotice(result) : undefined | ||
| }) | ||
|
|
||
| return noticeText | ||
| return notice | ||
| ? <DismissibleNotice | ||
| className="code-snippets-notice" | ||
| onDismiss={() => { | ||
| setNoticeText(undefined) | ||
| setNotice(undefined) | ||
| }} | ||
| type="success"> | ||
| <p>{createInterpolateElement(noticeText, { strong: <strong /> })}</p> | ||
| type={notice.type}> | ||
| <p>{createInterpolateElement(notice.text, { strong: <strong /> })}</p> | ||
| </DismissibleNotice> | ||
| : null | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.