Skip to content

Commit f4eeb1a

Browse files
committed
chore: notification bubble ui changes. add git feature help bubble on first git panle show
1 parent 0bb3c4c commit f4eeb1a

File tree

8 files changed

+88
-31
lines changed

8 files changed

+88
-31
lines changed

src/assets/new-project/assets/css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ img {
11201120
top: 0;
11211121
left: 0;
11221122
background: #fd7e14;
1123-
color: white;
1123+
color: black;
11241124
padding: 5px;
11251125
border-radius: 4px;
11261126
opacity: 0;

src/extensions/default/Git/src/Panel.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ define(function (require, exports) {
2020
StringUtils = brackets.getModule("utils/StringUtils"),
2121
Strings = brackets.getModule("strings"),
2222
Metrics = brackets.getModule("utils/Metrics"),
23+
NotificationUI = brackets.getModule("widgets/NotificationUI"),
2324
Constants = require("src/Constants"),
2425
Git = require("src/git/Git"),
2526
Events = require("./Events"),
@@ -1386,6 +1387,15 @@ define(function (require, exports) {
13861387
if(!StateManager.get(GIT_PANEL_SHOWN_ON_FIRST_BOOT)){
13871388
StateManager.set(GIT_PANEL_SHOWN_ON_FIRST_BOOT, true);
13881389
toggle(true);
1390+
NotificationUI.createFromTemplate(
1391+
Strings.GIT_TOAST_TITLE,
1392+
Strings.GIT_TOAST_MESSAGE,
1393+
"git-toolbar-icon", {
1394+
allowedPlacements: ['left'],
1395+
dismissOnClick: true,
1396+
toastStyle: "width-250"
1397+
}
1398+
);
13891399
}
13901400
// Add info from Git to panel
13911401
Git.getConfig("user.name").then(function (currentUserName) {

src/extensionsIntegrated/Phoenix/guided-tour.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ define(function (require, exports, module) {
8484
userAlreadyDidAction.beautifyCodeShown = true;
8585
PhStore.setItem(GUIDED_TOUR_LOCAL_STORAGE_KEY, JSON.stringify(userAlreadyDidAction));
8686
Metrics.countEvent(Metrics.EVENT_TYPE.UI, "guide", "beautify");
87-
currentlyShowingNotification = NotificationUI.createFromTemplate(
87+
currentlyShowingNotification = NotificationUI.createFromTemplate( Strings.CMD_BEAUTIFY_CODE,
8888
StringUtils.format(Strings.BEAUTIFY_CODE_NOTIFICATION, keyboardShortcut),
8989
"editor-context-menu-edit.beautifyCode", {
9090
allowedPlacements: ['left', 'right'],
@@ -113,7 +113,8 @@ define(function (require, exports, module) {
113113
userAlreadyDidAction.newProjectShown = true;
114114
PhStore.setItem(GUIDED_TOUR_LOCAL_STORAGE_KEY, JSON.stringify(userAlreadyDidAction));
115115
Metrics.countEvent(Metrics.EVENT_TYPE.UI, "guide", "newProj");
116-
currentlyShowingNotification = NotificationUI.createFromTemplate(Strings.NEW_PROJECT_NOTIFICATION,
116+
currentlyShowingNotification = NotificationUI.createFromTemplate(
117+
Strings.START_PROJECT, Strings.NEW_PROJECT_NOTIFICATION,
117118
"newProject", {
118119
allowedPlacements: ['top', 'bottom'],
119120
autoCloseTimeS: 15,

src/nls/root/strings.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ define({
878878
"HEALTH_DATA_NOTIFICATION": "Health Report Preferences",
879879
"HEALTH_FIRST_POPUP_TITLE": "Privacy Notice",
880880
"HEALTH_DATA_DO_TRACK": "Share anonymous information on how I use {APP_NAME}",
881-
"HEALTH_DATA_NOTIFICATION_MESSAGE": "{APP_NAME} <strong>does not collect or process any personally identifiable information</strong>, but <strong>collects anonymous usage statistics</strong> to guard your privacy. Anonymous data is exempt from GDPR/CCPA notification requirements, but we believe you need to have a choice to opt out of anonymous data collection as well.<br><br> You can see your data or <strong>choose not to share any anonymous data</strong> by selecting <strong>Help > Health Report</strong>. These <strong>anonymous</strong> app usage statistics and error reports helps prioritize features, find bugs, and spot usability issues for improving your experience with {APP_NAME}. Without this data, we would not know what features it is worth building for you! <br><br>",
881+
"HEALTH_DATA_NOTIFICATION_MESSAGE": "{APP_NAME} <strong>does not collect or process any personally identifiable information</strong>, but <strong>collects anonymous usage statistics</strong> to guard your privacy. Anonymous data is exempt from GDPR/CCPA notification requirements, but we believe you need to have a choice to opt out of anonymous data collection as well.<br><br> You can see your data or <strong>choose not to share any anonymous data</strong> by selecting <strong>Help > Health Report</strong>. These <strong>anonymous</strong> app usage statistics and error reports helps prioritize features, find bugs, and spot usability issues for improving your experience with {APP_NAME}. Without this data, we would not know what features it is worth building for you! <br>",
882882
"HEALTH_DATA_PREVIEW": "{APP_NAME} Health Report",
883883
"HEALTH_DATA_PREVIEW_INTRO": "<p>{APP_NAME} <strong>does not collect or process any personally identifiable information</strong>, but <strong>collects anonymous usage statistics</strong> to guard your privacy. These <strong>anonymous</strong> app usage statistics and error reports helps prioritize features, find bugs, and spot usability issues for improving your experience with {APP_NAME}.</p> <p>Below is a preview of the data that will be sent in your next Health Report <em>if</em> it is enabled. (Also see developer console for error logs marked 'Caught Critical error'.)</p>",
884884

@@ -1218,9 +1218,9 @@ define({
12181218
"PREVIEW": "Preview",
12191219
"BUILD_WEBSITE": "Build Website",
12201220
"VIEW_MORE": "View More...",
1221-
"NEW_PROJECT_NOTIFICATION": "Click this icon to open the `New Project` window again.</br> See Recent Projects, Open Folder or start projects from templates.</br> <img src=\"styles/images/new_project.png\"> <br/> <a href='#' style='float:right;'>ok</a>",
1222-
"BEAUTIFY_CODE_NOTIFICATION": "Click here or press <b>`{0}`</b> to Beautify code. </br> <img src=\"styles/images/beautify.gif\"> <br/> <a href='#' style='float:right;'>ok</a>",
1223-
"DEFAULT_PROJECT_NOTIFICATION": "Click here to open the <br/><b>default project</b> in phoenix. </br> <a href='#' style='float:right;'>ok</a>",
1221+
"NEW_PROJECT_NOTIFICATION": "Click this icon to open the `Start Project` window again.</br> See Recent Projects, Open Folder or start projects from templates.</br> <img src=\"styles/images/new_project.png\">",
1222+
"BEAUTIFY_CODE_NOTIFICATION": "Click here or press <b>`{0}`</b> to beautify code. </br> <img src=\"styles/images/beautify.gif\">",
1223+
"DEFAULT_PROJECT_NOTIFICATION": "Click here to open the <br/><b>default project</b> in {APP_NAME}. </br> <a href='#' style='float:right;'>ok</a>",
12241224
"DIRECTORY_REPLACE_MESSAGE": "The selected folder <span class='dialog-filename'>{0}</span> is not empty. Are you sure you want to replace the folder contents with the project?",
12251225
"DEFAULT_PROJECT_HTML_CLICK_HERE": "Click here to locate this &lt;span&gt; in the HTML file",
12261226
"BUILD_WEBSITE_SECTION": "Build Website",
@@ -1529,6 +1529,8 @@ define({
15291529
"ERROR_NO_REMOTE_SELECTED": "No remote has been selected for {0}!",
15301530
"ERROR_BRANCH_LIST": "Getting branch list failed",
15311531
"ERROR_FETCH_REMOTE": "Fetching remote information failed",
1532+
"GIT_TOAST_TITLE": "Explore Git Features in Phoenix Code",
1533+
"GIT_TOAST_MESSAGE": "Click the Git panel icon to manage your repository. Easily commit, push, pull, and view your project history—all in one place.<br><a href='https://docs.phcode.dev/docs/Features/git'>Learn more about the Git panel →</a>",
15321534

15331535
// surveys
15341536
"SURVEY_TITLE_VOTE_FOR_FEATURES_YOU_WANT": "Vote for the features you want to see next!"

src/styles/brackets.less

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3215,35 +3215,35 @@ label input {
32153215
color: black; // text color
32163216
}
32173217

3218-
.notification-popup-container.style-danger {
3218+
.notification-ui-tooltip.style-danger, .notification-ui-arrow.style-danger, .notification-popup-container.style-danger {
32193219
background: var(--bc-toast-danger-bg-color);
32203220
a {
32213221
color: white;
32223222
cursor: pointer;
32233223
}
32243224
}
3225-
.notification-popup-container.style-error {
3225+
.notification-ui-tooltip.style-error, .notification-ui-arrow.style-error, .notification-popup-container.style-error {
32263226
background: var(--bc-toast-error-bg-color);
32273227
a {
32283228
color: white;
32293229
cursor: pointer;
32303230
}
32313231
}
3232-
.notification-popup-container.style-info {
3232+
.notification-ui-tooltip.style-info, .notification-ui-arrow.style-info, .notification-popup-container.style-info {
32333233
background: var(--bc-toast-info-bg-color);
32343234
a {
32353235
color: blue;
32363236
cursor: pointer;
32373237
}
32383238
}
3239-
.notification-popup-container.style-success {
3239+
.notification-ui-tooltip.style-success, .notification-ui-arrow.style-success, .notification-popup-container.style-success {
32403240
background: var(--bc-toast-success-bg-color);
32413241
a {
32423242
color: darkblue;
32433243
cursor: pointer;
32443244
}
32453245
}
3246-
.notification-popup-container.style-warning {
3246+
.notification-ui-tooltip.style-warning, .notification-ui-arrow.style-warning, .notification-popup-container.style-warning {
32473247
background: var(--bc-toast-warning-bg-color);
32483248
a {
32493249
color: white;
@@ -3273,6 +3273,10 @@ label input {
32733273
top: 0;
32743274
right: 8px;
32753275
cursor: pointer;
3276+
color: @notification-text;
3277+
}
3278+
.notification-popup-close-button.arrow {
3279+
top: 8px;
32763280
}
32773281
.notification-popup-close-button:hover {
32783282
color: white;
@@ -3281,10 +3285,16 @@ label input {
32813285
.notification-dialog-title {
32823286
font-size: 16px;
32833287
font-weight: bold;
3288+
padding-right: 25px;
32843289
}
32853290

32863291
.notification-dialog-content a {
3287-
color: #00ccff;
3292+
a {
3293+
color: @bc-text-beige;
3294+
}
3295+
a:hover {
3296+
color: @bc-text-alt;
3297+
}
32883298
}
32893299

32903300
.github-stars-button {

src/styles/brackets_core_ui_variables.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292

9393
// Text
9494
@bc-text: #333;
95+
@bc-text-beige: #F5E6D3;
9596
@bc-text-alt: #fff;
9697
@bc-text-emphasized: #111;
9798
@bc-text-link: #0083e8;
@@ -202,6 +203,7 @@
202203
@dark-bc-warning-bg-low: #ffd966;
203204
@dark-bc-warning-text: #fff;
204205
@dark-bc-warning-text-low: #333333;
206+
@notification-text: #333333;
205207

206208
// Text
207209
@dark-bc-text: #ccc;

src/styles/brackets_patterns_override.less

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,23 @@ a:focus {
9595
top: 0;
9696
left: 0;
9797
background: #fd7e14;
98-
color: white;
98+
color: black;
9999
font-weight: bold;
100-
padding: 5px;
100+
padding: 9px 12px 9px 12px;
101+
min-width: 200px;
102+
max-width: 450px;
101103
border-radius: 4px;
102104
font-size: 90%;
103105
opacity: 0;
106+
p {
107+
margin-bottom: 5px;
108+
}
109+
a {
110+
color: @bc-text-beige;
111+
}
112+
a:hover {
113+
color: @bc-text-alt;
114+
}
104115
}
105116
.notification-ui-hidden {
106117
opacity: 0;
@@ -112,6 +123,9 @@ a:focus {
112123
transition: opacity 0.5s ease;
113124
transition-delay:0.2s;
114125
}
126+
.width-250 {
127+
width: 250px;
128+
}
115129
/* working set drag ghost styles */
116130

117131
.wsv-drag-ghost {

src/widgets/NotificationUI.js

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ define(function (require, exports, module) {
198198
* });
199199
* ```
200200
*
201+
* @param {string} title The title for the notification.
201202
* @param {string|Element} template A string template or HTML Element to use as the dialog HTML.
202203
* @param {String} [elementID] optional id string if provided will show the notification pointing to the element.
203204
* If no element is specified, it will be managed as a generic notification.
@@ -207,19 +208,21 @@ define(function (require, exports, module) {
207208
* Values can be a mix of `['top', 'bottom', 'left', 'right']`
208209
* * `autoCloseTimeS` - Time in seconds after which the notification should be auto closed. Default is never.
209210
* * `dismissOnClick` - when clicked, the notification is closed. Default is true(dismiss).
211+
* * `toastStyle` - To style the toast notification for error, warning, info etc. Can be
212+
* one of `NotificationUI.NOTIFICATION_STYLES_CSS_CLASS.*` or your own css class name.
210213
* @return {Notification} Object with a done handler that resolves when the notification closes.
211214
* @type {function}
212215
*/
213-
function createFromTemplate(template, elementID, options= {}) {
216+
function createFromTemplate(title, template, elementID, options= {}) {
214217
// https://floating-ui.com/docs/tutorial
215218
options.allowedPlacements = options.allowedPlacements || ['top', 'bottom', 'left', 'right'];
216219
options.dismissOnClick = options.dismissOnClick === undefined ? true : options.dismissOnClick;
217220
if(!elementID){
218221
elementID = 'notificationUIDefaultAnchor';
219222
}
220-
const tooltip = _createDomElementWithArrowElement(template, elementID, options);
221-
tooltip.addClass('notification-ui-visible');
222-
let notification = (new Notification(tooltip, NOTIFICATION_TYPE_ARROW));
223+
const $tooltip = _createDomElementWithArrowElement(title, template, elementID, options);
224+
$tooltip.addClass('notification-ui-visible');
225+
let notification = (new Notification($tooltip, NOTIFICATION_TYPE_ARROW));
223226

224227
if(options.autoCloseTimeS){
225228
setTimeout(()=>{
@@ -228,10 +231,13 @@ define(function (require, exports, module) {
228231
}
229232

230233
if(options.dismissOnClick){
231-
tooltip.click(()=>{
234+
$tooltip.click(()=>{
232235
notification.close(CLOSE_REASON.CLICK_DISMISS);
233236
});
234237
}
238+
$tooltip.find(".notification-popup-close-button").click(()=>{
239+
notification.close(CLOSE_REASON.CLICK_DISMISS);
240+
});
235241
return notification;
236242
}
237243

@@ -287,7 +293,7 @@ define(function (require, exports, module) {
287293
WorkspaceManager.on(WorkspaceManager.EVENT_WORKSPACE_UPDATE_LAYOUT, tooltip.update);
288294
}
289295

290-
function _createDomElementWithArrowElement(domTemplate, elementID, options) {
296+
function _createDomElementWithArrowElement(title, domTemplate, elementID, options) {
291297
notificationWidgetCount++;
292298
const onElement = document.getElementById(elementID);
293299
let arrowElement;
@@ -297,18 +303,29 @@ define(function (require, exports, module) {
297303
if (typeof domTemplate === 'string' || domTemplate instanceof String){
298304
textTemplate = domTemplate;
299305
}
300-
let floatingDom = $(`<div id="${widgetID}" class="notification-ui-tooltip" role="tooltip">
301-
${textTemplate||''}</div>`);
306+
const styleClass = NOTIFICATION_STYLES_CSS_CLASS[options.toastStyle]
307+
|| options.toastStyle;
308+
let $floatingDom = $(`<div id="${widgetID}" class="notification-ui-tooltip ${styleClass}" role="tooltip">
309+
<div>
310+
<p class='notification-popup-close-button arrow'>×</p>
311+
</div>
312+
<div >
313+
<p class="notification-dialog-title">${title}</p>
314+
</div>
315+
<div>
316+
<p class="notification-dialog-content">${textTemplate||''}</p>
317+
</div></div>`);
302318
if(!textTemplate && domTemplate){
303-
floatingDom.append($(domTemplate));
319+
$floatingDom.find(".notification-dialog-content").append($(domTemplate));
304320
}
305321
if(onElement){
306-
arrowElement = $(`<div id="${arrowID}" class="notification-ui-arrow"></div>`);
307-
floatingDom.append(arrowElement);
322+
arrowElement = $(`<div id="${arrowID}" class="notification-ui-arrow ${
323+
NOTIFICATION_STYLES_CSS_CLASS[options.toastStyle] || ''}"></div>`);
324+
$floatingDom.append(arrowElement);
308325
}
309-
$("body").append(floatingDom);
310-
_updatePositions(floatingDom[0], onElement, arrowElement[0], options);
311-
return floatingDom;
326+
$("body").append($floatingDom);
327+
_updatePositions($floatingDom[0], onElement, arrowElement[0], options);
328+
return $floatingDom;
312329
}
313330

314331
/**
@@ -340,10 +357,11 @@ define(function (require, exports, module) {
340357
function createToastFromTemplate(title, template, options = {}) {
341358
options.dismissOnClick = options.dismissOnClick === undefined ? true : options.dismissOnClick;
342359
notificationWidgetCount++;
360+
const styleClass = NOTIFICATION_STYLES_CSS_CLASS[options.toastStyle]
361+
|| options.toastStyle || NOTIFICATION_STYLES_CSS_CLASS.INFO;
343362
const widgetID = `notification-toast-${notificationWidgetCount}`,
344363
$NotificationPopup = $(Mustache.render(ToastPopupHtml, {id: widgetID, title: title,
345-
containerStyle: NOTIFICATION_STYLES_CSS_CLASS[options.toastStyle]
346-
|| options.toastStyle || NOTIFICATION_STYLES_CSS_CLASS.INFO}));
364+
containerStyle: styleClass}));
347365
$NotificationPopup.find(".notification-dialog-content")
348366
.append($(template));
349367

0 commit comments

Comments
 (0)