From ad9c0ed9a910641327fe659d2a35429679c81bd5 Mon Sep 17 00:00:00 2001 From: Kuldeep Matharu Date: Sat, 10 Aug 2024 12:15:46 +0100 Subject: [PATCH] dismiss --- package-lock.json | 6 +++--- package.json | 4 ++-- src/component/groupAndBookmark/index.js | 1 - src/component/layout/index.js | 19 +++++++++++++------ src/component/notification/index.js | 8 ++++++++ src/component/state/index.js | 3 ++- src/component/update/index.js | 16 ++++++++++++---- src/component/version/index.js | 2 +- src/manifest.json | 4 ++-- 9 files changed, 43 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed2d5eaa..be7e7948 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nightTab", - "version": "7.6.0", + "version": "7.7.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nightTab", - "version": "7.6.0", + "version": "7.7.0", "license": "GPL-3", "devDependencies": { "copy-webpack-plugin": "^12.0.2", @@ -6582,4 +6582,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 91dd2fb0..2a8bf074 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nightTab", - "version": "7.6.0", + "version": "7.7.0", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks with nightTab.", "main": "index.js", "scripts": { @@ -44,4 +44,4 @@ "webpack-merge": "^5.10.0", "zip-webpack-plugin": "^4.0.1" } -} +} \ No newline at end of file diff --git a/src/component/groupAndBookmark/index.js b/src/component/groupAndBookmark/index.js index 9ee427b7..0933631b 100644 --- a/src/component/groupAndBookmark/index.js +++ b/src/component/groupAndBookmark/index.js @@ -32,7 +32,6 @@ groupAndBookmark.render = () => { } - } else { group.sort.bind(); diff --git a/src/component/layout/index.js b/src/component/layout/index.js index fa7bef31..357338ae 100644 --- a/src/component/layout/index.js +++ b/src/component/layout/index.js @@ -1,4 +1,5 @@ import { state } from '../state'; +import { data } from '../data'; import { Notification } from '../notification'; @@ -29,15 +30,21 @@ layout.area = { const body = document.querySelector('body'); - const notification = new Notification({ - children: [ + if (!state.get.current().header.search.removalNotice) { - complexNode({ tag: 'p', text: 'Search in nightTab will be removed to comply with a Chrome policy change. Filtering bookmarks will remain. Read more about this change on the nightTab repo.', complexText: true }) + const notification = new Notification({ + children: [ + complexNode({ tag: 'p', text: 'Search in nightTab will be removed to comply with a Chrome policy change. Filtering bookmarks will remain. Read more about this change on the nightTab repo.', attr: [{ key: 'class', value: 'small' }], complexText: true }) + ], + dismissAction: () => { + state.get.current().header.search.removalNotice = true; + data.save(); + } + }); - ] - }); + body.append(notification.notification()); - body.append(notification.notification()); + }; body.append(layout.element.layout); diff --git a/src/component/notification/index.js b/src/component/notification/index.js index 2d96695e..7a6ce77e 100644 --- a/src/component/notification/index.js +++ b/src/component/notification/index.js @@ -6,6 +6,7 @@ import './index.css'; export const Notification = function ({ children = [], + dismissAction = false, } = {}) { this.element = { @@ -18,6 +19,13 @@ export const Notification = function ({ size: 'small', style: ['ring'], func: () => { + + if (dismissAction) { + dismissAction(); + } + + this.element.notification.remove(); + } }), }; diff --git a/src/component/state/index.js b/src/component/state/index.js index 9cc64f71..d8103606 100644 --- a/src/component/state/index.js +++ b/src/component/state/index.js @@ -53,7 +53,8 @@ state.default = { text: { justify: 'center' }, size: 100, newLine: false, - newTab: false + newTab: false, + removalNotice: false }, order: [], edit: false diff --git a/src/component/update/index.js b/src/component/update/index.js index deae4856..f02e5dcc 100644 --- a/src/component/update/index.js +++ b/src/component/update/index.js @@ -6,7 +6,7 @@ const update = {}; update.mod = updateLegacy.get(); -update.mod['7.0.0'] = function(data) { +update.mod['7.0.0'] = function (data) { data.state.header.order.splice(data.state.header.order.indexOf('editAdd'), 1); data.state.header.order.splice(data.state.header.order.indexOf('colorAccent'), 1); @@ -573,7 +573,7 @@ update.mod['7.0.0'] = function(data) { }; -update.mod['7.1.0'] = function(data) { +update.mod['7.1.0'] = function (data) { data.state.layout.favicon = ''; @@ -608,7 +608,7 @@ update.mod['7.1.0'] = function(data) { }; -update.mod['7.4.0'] = function(data) { +update.mod['7.4.0'] = function (data) { data.state.layout.overscroll = { active: data.state.layout.overscroll, @@ -619,7 +619,7 @@ update.mod['7.4.0'] = function(data) { }; -update.mod['7.5.0'] = function(data) { +update.mod['7.5.0'] = function (data) { data.state.language = 'system'; @@ -627,6 +627,14 @@ update.mod['7.5.0'] = function(data) { }; +update.mod['7.7.0'] = function (data) { + + data.state.header.search.removalNotice = false; + + return data; + +}; + update.run = (data) => { // loop over all updates in mod.all object diff --git a/src/component/version/index.js b/src/component/version/index.js index db9ea64e..5855ad0b 100644 --- a/src/component/version/index.js +++ b/src/component/version/index.js @@ -1,6 +1,6 @@ export const version = {}; -version.number = '7.6.0'; +version.number = '7.7.0'; version.name = 'Nebulous Lobster'; diff --git a/src/manifest.json b/src/manifest.json index b1390c2b..9b8882ba 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "name": "__MSG_appName__", "short_name": "__MSG_appShortName__", "description": "__MSG_appDescription__", - "version": "7.6.0", + "version": "7.7.0", "manifest_version": 3, "default_locale": "en_GB", "chrome_url_overrides": { @@ -14,4 +14,4 @@ "128": "icon/icon-128.png", "512": "icon/icon-512.png" } -} +} \ No newline at end of file