feat: add share indicators for calendars and contacts, update JMAP capabilities #244
This commit is contained in:
@@ -144,6 +144,12 @@ export function CalendarSidebarPanel({
|
|||||||
{cal.id === BIRTHDAY_CALENDAR_ID && (
|
{cal.id === BIRTHDAY_CALENDAR_ID && (
|
||||||
<Cake className="w-3 h-3 text-muted-foreground flex-shrink-0" />
|
<Cake className="w-3 h-3 text-muted-foreground flex-shrink-0" />
|
||||||
)}
|
)}
|
||||||
|
{!cal.isShared && Object.keys(cal.shareWith || {}).length > 0 && (
|
||||||
|
<Users
|
||||||
|
className="w-3 h-3 text-muted-foreground flex-shrink-0 ml-auto"
|
||||||
|
aria-label={tMgmt('share')}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -685,7 +685,13 @@ function AddressBookItem({
|
|||||||
>
|
>
|
||||||
<Book className="w-4 h-4 flex-shrink-0" />
|
<Book className="w-4 h-4 flex-shrink-0" />
|
||||||
<span className="truncate">{book.name}</span>
|
<span className="truncate">{book.name}</span>
|
||||||
<span className="ml-auto text-xs text-muted-foreground tabular-nums">
|
{!book.isShared && Object.keys(book.shareWith || {}).length > 0 && (
|
||||||
|
<Users className="w-3 h-3 text-muted-foreground flex-shrink-0 ml-auto" />
|
||||||
|
)}
|
||||||
|
<span className={cn(
|
||||||
|
"text-xs text-muted-foreground tabular-nums",
|
||||||
|
!(!book.isShared && Object.keys(book.shareWith || {}).length > 0) && "ml-auto"
|
||||||
|
)}>
|
||||||
{contactCount}
|
{contactCount}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -139,6 +139,19 @@ export function AddressBookManagementSettings() {
|
|||||||
{t("default")}
|
{t("default")}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
{(() => {
|
||||||
|
const shareCount = Object.keys(book.shareWith || {}).length;
|
||||||
|
if (shareCount === 0 || book.isShared) return null;
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className="flex items-center gap-1 text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded-full"
|
||||||
|
title={t("share")}
|
||||||
|
>
|
||||||
|
<Users className="w-3 h-3" />
|
||||||
|
{shareCount}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
<div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
<div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||||
{canRename && (
|
{canRename && (
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -516,6 +516,20 @@ export function CalendarManagementSettings() {
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{(() => {
|
||||||
|
const shareCount = Object.keys(cal.shareWith || {}).length;
|
||||||
|
if (shareCount === 0 || cal.isShared) return null;
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className="flex items-center gap-1 text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded-full"
|
||||||
|
title={t('share')}
|
||||||
|
>
|
||||||
|
<Users className="w-3 h-3" />
|
||||||
|
{shareCount}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
|
|
||||||
<div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
<div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
+10
-2
@@ -3079,11 +3079,19 @@ export class JMAPClient implements IJMAPClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private contactUsing(): string[] {
|
private contactUsing(): string[] {
|
||||||
return ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:contacts"];
|
const using = ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:contacts"];
|
||||||
|
if (this.hasCapability("urn:ietf:params:jmap:principals")) {
|
||||||
|
using.push("urn:ietf:params:jmap:principals:owner");
|
||||||
|
}
|
||||||
|
return using;
|
||||||
}
|
}
|
||||||
|
|
||||||
private calendarUsing(): string[] {
|
private calendarUsing(): string[] {
|
||||||
return ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:calendars"];
|
const using = ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:calendars"];
|
||||||
|
if (this.hasCapability("urn:ietf:params:jmap:principals")) {
|
||||||
|
using.push("urn:ietf:params:jmap:principals:owner");
|
||||||
|
}
|
||||||
|
return using;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCalendarCapableAccountIds(): string[] {
|
private getCalendarCapableAccountIds(): string[] {
|
||||||
|
|||||||
Reference in New Issue
Block a user