Skip to content
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

feat: show contact details modal on click #92

Open
wants to merge 5 commits into
base: TB102
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/_locales/en-US/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,27 @@
"popup.input.title": {
"message": "Please enter a (sub)category"
},
"popup.detail.nickname": {
"message": "Nickname"
},
"popup.detail.timezone": {
"message": "Timezone"
},
"popup.detail.emails": {
"message": "Emails"
},
"popup.detail.websites": {
"message": "Websites"
},
"popup.detail.addresses": {
"message": "Addresses"
},
"popup.detail.phone-numbers": {
"message": "Phone Numbers"
},
"popup.detail.notes": {
"message": "Notes"
},
"tree.category.all": {
"message": "All contacts"
},
Expand Down
21 changes: 21 additions & 0 deletions src/_locales/es-AR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,27 @@
"popup.input.title": {
"message": "Please enter a (sub)category"
},
"popup.detail.nickname": {
"message": "Nickname"
},
"popup.detail.timezone": {
"message": "Timezone"
},
"popup.detail.emails": {
"message": "Emails"
},
"popup.detail.websites": {
"message": "Websites"
},
"popup.detail.addresses": {
"message": "Addresses"
},
"popup.detail.phone-numbers": {
"message": "Phone Numbers"
},
"popup.detail.notes": {
"message": "Notes"
},
"tree.category.all": {
"message": "Todos los contactos"
},
Expand Down
21 changes: 21 additions & 0 deletions src/_locales/es-ES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,27 @@
"popup.input.title": {
"message": "Please enter a (sub)category"
},
"popup.detail.nickname": {
"message": "Nickname"
},
"popup.detail.timezone": {
"message": "Timezone"
},
"popup.detail.emails": {
"message": "Emails"
},
"popup.detail.websites": {
"message": "Websites"
},
"popup.detail.addresses": {
"message": "Addresses"
},
"popup.detail.phone-numbers": {
"message": "Phone Numbers"
},
"popup.detail.notes": {
"message": "Notes"
},
"tree.category.all": {
"message": "Todos los contactos"
},
Expand Down
21 changes: 21 additions & 0 deletions src/_locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,27 @@
"popup.input.title": {
"message": "Please enter a (sub)category"
},
"popup.detail.nickname": {
"message": "Nickname"
},
"popup.detail.timezone": {
"message": "Timezone"
},
"popup.detail.emails": {
"message": "Emails"
},
"popup.detail.websites": {
"message": "Websites"
},
"popup.detail.addresses": {
"message": "Addresses"
},
"popup.detail.phone-numbers": {
"message": "Phone Numbers"
},
"popup.detail.notes": {
"message": "Notes"
},
"tree.category.all": {
"message": "Tous les contacts"
},
Expand Down
21 changes: 21 additions & 0 deletions src/_locales/nl/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,27 @@
"popup.input.title": {
"message": "Please enter a (sub)category"
},
"popup.detail.nickname": {
"message": "Nickname"
},
"popup.detail.timezone": {
"message": "Timezone"
},
"popup.detail.emails": {
"message": "Emails"
},
"popup.detail.websites": {
"message": "Websites"
},
"popup.detail.addresses": {
"message": "Addresses"
},
"popup.detail.phone-numbers": {
"message": "Phone Numbers"
},
"popup.detail.notes": {
"message": "Notes"
},
"tree.category.all": {
"message": "Alle contacten"
},
Expand Down
21 changes: 21 additions & 0 deletions src/_locales/pt-BR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,27 @@
"popup.input.title": {
"message": "Please enter a (sub)category"
},
"popup.detail.nickname": {
"message": "Nickname"
},
"popup.detail.timezone": {
"message": "Timezone"
},
"popup.detail.emails": {
"message": "Emails"
},
"popup.detail.websites": {
"message": "Websites"
},
"popup.detail.addresses": {
"message": "Addresses"
},
"popup.detail.phone-numbers": {
"message": "Phone Numbers"
},
"popup.detail.notes": {
"message": "Notes"
},
"tree.category.all": {
"message": "Todos os contatos"
},
Expand Down
21 changes: 21 additions & 0 deletions src/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,27 @@
"popup.input.title": {
"message": "Please enter a (sub)category"
},
"popup.detail.nickname": {
"message": "Nickname"
},
"popup.detail.timezone": {
"message": "Timezone"
},
"popup.detail.emails": {
"message": "Emails"
},
"popup.detail.websites": {
"message": "Websites"
},
"popup.detail.addresses": {
"message": "Addresses"
},
"popup.detail.phone-numbers": {
"message": "Phone Numbers"
},
"popup.detail.notes": {
"message": "Notes"
},
"tree.category.all": {
"message": "Все контакты"
},
Expand Down
29 changes: 25 additions & 4 deletions src/_locales/zh-CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"message": "正在更新..."
},
"manifest_action_title": {
"message": "Categories"
"message": "类别管理器"
},
"manifest_description": {
"message": "联系人类别管理器。你可以一次向整个类别的联系人发送邮件(基于类别的联系人群组)。"
},
"menu.category.add_members_to_current_message": {
"message": "Add category members to ..."
"message": "添加类别成员到 ..."
},
"menu.category.add_members_to_new_message": {
"message": "Compose new message with category members in ..."
"message": "编辑新消息并将此类别成员添加到 ..."
},
"menu.category.add_to_bcc": {
"message": "Bcc"
Expand All @@ -51,7 +51,7 @@
"message": "删除此类别"
},
"menu.category.rename": {
"message": "Rename or move this category"
"message": "重命名或移动此类别"
},
"menu.contact.context.add_to_category": {
"message": "添加到 '$CATEGORY$'",
Expand Down Expand Up @@ -118,6 +118,27 @@
"popup.input.title": {
"message": "请输入(子)类别"
},
"popup.detail.nickname": {
"message": "昵称"
},
"popup.detail.timezone": {
"message": "时区"
},
"popup.detail.emails": {
"message": "电子邮箱"
},
"popup.detail.websites": {
"message": "网站"
},
"popup.detail.addresses": {
"message": "地址"
},
"popup.detail.phone-numbers": {
"message": "电话号码"
},
"popup.detail.notes": {
"message": "备注"
},
"tree.category.none": {
"message": "未分类"
},
Expand Down
13 changes: 12 additions & 1 deletion src/popup/contact-list.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
escapeHtmlContent,
escapeHtmlAttr,
} from "../modules/ui/ui.mjs";
import { showDetailModal } from "./modal.mjs";

export function createContactList(data) {
let component = new Component({
Expand Down Expand Up @@ -34,7 +35,7 @@ export function createContactList(data) {
</p>
</li>`
);
})
});
}
return `<ul> ${html.join("\n")} </ul>`;
},
Expand All @@ -50,5 +51,15 @@ export function createContactList(data) {
e.target.dataset.addressbook + "\n" + e.target.dataset.id
);
});
component.element.addEventListener("click", (e) => {
let target = e.target;
if (target.dataset.id == null)
// Possibly click on children elements
target = target.parentElement;
if (target.dataset.id == null)
// Not a click on a contact
return;
showDetailModal(target.dataset.id);
});
return component;
}
66 changes: 63 additions & 3 deletions src/popup/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
line-height: 1.25;
color: #00449e;
box-sizing: border-box;
display: inline-flex;
align-items: center;
}

.modal__close {
Expand Down Expand Up @@ -183,11 +185,69 @@

#modal-error-title {
color: red;
display: inline-flex;
align-items: center;
font-size: 2rem;
}

#modal-error-title i {
.modal__title > i {
margin-right: 1rem;
}

.details__header-container {
display: flex;
align-items: center;
}

.details__photo {
width: 3rem;
height: 3rem;
line-height: 3rem;
background-size: contain !important;
background-color: lightgray;
border-radius: 50%;
text-align: center;
color: orangered;
font-weight: bold;
}

.details__header {
margin-left: 1.2rem;
}

.details__name {
font-size: 1.3rem;
font-weight: bold;
}

.details__email {
font-size: 1rem;
}

.details__grid {
display: grid;
grid-template-columns: auto auto;
column-gap: 1rem;
align-items: center;
overflow: scroll;
max-height: 24rem;
}

.details__grid > div:nth-child(2n + 1) {
font-weight: bold;
text-align: center;
}

.details__grid > p {
font-weight: normal;
margin-block: 0.5rem;
word-break: break-all;
hyphens: auto;
}

#modal-details .modal__container {
max-height: 80vh;
max-width: 80vw;
}

#modal-details-content {
margin-bottom: 0;
}
Loading