mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-03-27 07:45:54 +00:00
added notification q-app list
This commit is contained in:
parent
922db68e53
commit
93658b2ba4
@ -203,7 +203,8 @@
|
|||||||
"exp2": "Export Master Key",
|
"exp2": "Export Master Key",
|
||||||
"exp3": "Export",
|
"exp3": "Export",
|
||||||
"exp4": "Please choose a wallet to backup the private master key.",
|
"exp4": "Please choose a wallet to backup the private master key.",
|
||||||
"core": "Start Core Settings"
|
"core": "Start Core Settings",
|
||||||
|
"qappNotification1": "Q-App notifications"
|
||||||
},
|
},
|
||||||
"appinfo": {
|
"appinfo": {
|
||||||
"blockheight": "Block Height",
|
"blockheight": "Block Height",
|
||||||
|
@ -140,7 +140,9 @@ class NotificationBell extends connect(store)(LitElement) {
|
|||||||
${this.notificationCount ? html`
|
${this.notificationCount ? html`
|
||||||
<paper-icon-button style="color: green;" icon="icons:mail" @click=${() => this._toggleNotifications()} title="Q-Mail"></paper-icon-button>
|
<paper-icon-button style="color: green;" icon="icons:mail" @click=${() => this._toggleNotifications()} title="Q-Mail"></paper-icon-button>
|
||||||
` : html`
|
` : html`
|
||||||
<paper-icon-button icon="icons:mail" @click=${() => this._toggleNotifications()} title="Q-Mail"></paper-icon-button>
|
<paper-icon-button icon="icons:mail" @click=${() => {
|
||||||
|
this._openTabQmail()
|
||||||
|
}} title="Q-Mail"></paper-icon-button>
|
||||||
`}
|
`}
|
||||||
|
|
||||||
${this.notificationCount ? html`
|
${this.notificationCount ? html`
|
||||||
@ -188,6 +190,23 @@ class NotificationBell extends connect(store)(LitElement) {
|
|||||||
if (this.notifications.length === 0) return
|
if (this.notifications.length === 0) return
|
||||||
this.showNotifications = !this.showNotifications
|
this.showNotifications = !this.showNotifications
|
||||||
}
|
}
|
||||||
|
_openTabQmail() {
|
||||||
|
const query = `?service=APP&name=Q-Mail`
|
||||||
|
store.dispatch(setNewTab({
|
||||||
|
url: `qdn/browser/index.html${query}`,
|
||||||
|
id: 'q-mail-notification',
|
||||||
|
myPlugObj: {
|
||||||
|
"url": "qapps",
|
||||||
|
"domain": "core",
|
||||||
|
"page": `qdn/browser/index.html${query}`,
|
||||||
|
"title": "Q-Mail",
|
||||||
|
"icon": "vaadin:mailbox",
|
||||||
|
"mwcicon": "mail_outline",
|
||||||
|
"menus": [],
|
||||||
|
"parent": false
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
static styles = css`
|
static styles = css`
|
||||||
.layout {
|
.layout {
|
||||||
|
@ -14,7 +14,8 @@ class NotificationsView extends connect(store)(LitElement) {
|
|||||||
notificationConfig: { type: Object },
|
notificationConfig: { type: Object },
|
||||||
q_chatConfig: { type: Object },
|
q_chatConfig: { type: Object },
|
||||||
blockConfig: { type: Object },
|
blockConfig: { type: Object },
|
||||||
theme: { type: String, reflect: true }
|
theme: { type: String, reflect: true },
|
||||||
|
appNotificationList: {type: Array}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,6 +25,11 @@ class NotificationsView extends connect(store)(LitElement) {
|
|||||||
this.q_chatConfig = {}
|
this.q_chatConfig = {}
|
||||||
this.blockConfig = {}
|
this.blockConfig = {}
|
||||||
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
|
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
|
||||||
|
this.appNotificationList = [] // Fetch the list of apps from local storage
|
||||||
|
}
|
||||||
|
|
||||||
|
firstUpdated(){
|
||||||
|
this.appNotificationList = this.getAppsFromStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
@ -42,7 +48,7 @@ class NotificationsView extends connect(store)(LitElement) {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(min-width: 1150px) {
|
@media(min-width: 1400px) {
|
||||||
.notification-box {
|
.notification-box {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
@ -106,6 +112,18 @@ class NotificationsView extends connect(store)(LitElement) {
|
|||||||
transition: all .2s;
|
transition: all .2s;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.remove-button {
|
||||||
|
font-family: Roboto, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
color: var(--mdc-theme-primary);
|
||||||
|
background-color: transparent;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: none;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,12 +163,47 @@ class NotificationsView extends connect(store)(LitElement) {
|
|||||||
<label for="blockShowNotification">${translate("settings.shownotifications")}</label>
|
<label for="blockShowNotification">${translate("settings.shownotifications")}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="content-box">
|
||||||
|
<h4>${translate("settings.qappNotification1")}</h4>
|
||||||
|
${this.appNotificationList.map((app)=> html`
|
||||||
|
<div style="display: flex; justify-content: space-between; margin-top: 10px;">
|
||||||
|
${app}
|
||||||
|
<button class="remove-button" @click=${() => this.removeApp(app)}>Remove</button>
|
||||||
|
</div>
|
||||||
|
`)}
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
${this.renderSetCoreButton()}
|
${this.renderSetCoreButton()}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAppsFromStorage() {
|
||||||
|
// Your method to fetch the list of apps from local storage
|
||||||
|
// Example:
|
||||||
|
const address= store.getState().app.selectedAddress.address
|
||||||
|
const id = `appNotificationList-${address}`;
|
||||||
|
const data = localStorage.getItem(id);
|
||||||
|
return data ? Object.keys(JSON.parse(data)) : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
removeApp(appName) {
|
||||||
|
// Remove the app from local storage
|
||||||
|
this.removeAppFromStorage(appName);
|
||||||
|
// Update the apps list in the component
|
||||||
|
this.appNotificationList = this.appNotificationList.filter(app => app !== appName);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeAppFromStorage(appName) {
|
||||||
|
// Your method to remove the app from local storage
|
||||||
|
const address= store.getState().app.selectedAddress.address
|
||||||
|
const id = `appNotificationList-${address}`;
|
||||||
|
const data = JSON.parse(localStorage.getItem(id) || '{}');
|
||||||
|
delete data[appName];
|
||||||
|
localStorage.setItem(id, JSON.stringify(data));
|
||||||
|
}
|
||||||
|
|
||||||
renderSetCoreButton() {
|
renderSetCoreButton() {
|
||||||
if (!isElectron()) {
|
if (!isElectron()) {
|
||||||
return html``
|
return html``
|
||||||
|
@ -225,7 +225,6 @@ class ChatRightPanel extends LitElement {
|
|||||||
if(this.groupMembers.length < 20){
|
if(this.groupMembers.length < 20){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('this.leaveGroupObjp', this.leaveGroupObj)
|
|
||||||
this.getMoreMembers(this.leaveGroupObj.groupId)
|
this.getMoreMembers(this.leaveGroupObj.groupId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +251,6 @@ class ChatRightPanel extends LitElement {
|
|||||||
activeChatHeadUrl=""
|
activeChatHeadUrl=""
|
||||||
.setActiveChatHeadUrl=${(val) => {
|
.setActiveChatHeadUrl=${(val) => {
|
||||||
if (val.address === this.myAddress) return;
|
if (val.address === this.myAddress) return;
|
||||||
console.log({ val });
|
|
||||||
this.selectedHead = val;
|
this.selectedHead = val;
|
||||||
this.setOpenUserInfo(true);
|
this.setOpenUserInfo(true);
|
||||||
this.setUserName({
|
this.setUserName({
|
||||||
@ -269,7 +267,6 @@ class ChatRightPanel extends LitElement {
|
|||||||
activeChatHeadUrl=""
|
activeChatHeadUrl=""
|
||||||
.setActiveChatHeadUrl=${(val) => {
|
.setActiveChatHeadUrl=${(val) => {
|
||||||
if (val.address === this.myAddress) return;
|
if (val.address === this.myAddress) return;
|
||||||
console.log({ val });
|
|
||||||
this.selectedHead = val;
|
this.selectedHead = val;
|
||||||
this.setOpenUserInfo(true);
|
this.setOpenUserInfo(true);
|
||||||
this.setUserName({
|
this.setUserName({
|
||||||
@ -286,7 +283,6 @@ class ChatRightPanel extends LitElement {
|
|||||||
activeChatHeadUrl=""
|
activeChatHeadUrl=""
|
||||||
.setActiveChatHeadUrl=${(val) => {
|
.setActiveChatHeadUrl=${(val) => {
|
||||||
if (val.address === this.myAddress) return;
|
if (val.address === this.myAddress) return;
|
||||||
console.log({ val });
|
|
||||||
this.selectedHead = val;
|
this.selectedHead = val;
|
||||||
this.setOpenUserInfo(true);
|
this.setOpenUserInfo(true);
|
||||||
this.setUserName({
|
this.setUserName({
|
||||||
|
@ -2831,6 +2831,7 @@ class WebBrowser extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
addAppToNotificationList(appName) {
|
addAppToNotificationList(appName) {
|
||||||
|
if(!appName) throw new Error('unknown app name')
|
||||||
const id = `appNotificationList-${this.selectedAddress.address}`;
|
const id = `appNotificationList-${this.selectedAddress.address}`;
|
||||||
const checkData = localStorage.getItem(id) ? JSON.parse(localStorage.getItem(id)) : null;
|
const checkData = localStorage.getItem(id) ? JSON.parse(localStorage.getItem(id)) : null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user