Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- Added SessionGuard component to manage session expiration and online status. - Updated AuthProvider to streamline session fetching and handling. - Introduced IdentityProvidersSection for managing OAuth, SAML, and LDAP identity providers. - Implemented identity provider guides for easier configuration. - Enhanced mail settings with infinite scroll option for improved user experience. - Updated global styles and layout components for better consistency across the application.
29 lines
864 B
TypeScript
29 lines
864 B
TypeScript
import type { DriveShare } from "@/lib/api/types"
|
|
import { NC_SHARE_TYPE } from "@/lib/drive/drive-share-types"
|
|
|
|
export type ShareButtonIcon = "lock" | "users" | "globe"
|
|
|
|
export function resolveShareButtonIcon(shares: DriveShare[]): ShareButtonIcon {
|
|
if (shares.length === 0) return "lock"
|
|
|
|
const hasPeople = shares.some(
|
|
(share) =>
|
|
share.share_type === NC_SHARE_TYPE.USER ||
|
|
share.share_type === NC_SHARE_TYPE.EMAIL ||
|
|
share.share_type === NC_SHARE_TYPE.GROUP
|
|
)
|
|
if (hasPeople) return "users"
|
|
|
|
const hasPublicLink = shares.some(
|
|
(share) =>
|
|
share.share_type === NC_SHARE_TYPE.LINK &&
|
|
(share.access_mode === "public" || !share.access_mode)
|
|
)
|
|
if (hasPublicLink) return "globe"
|
|
|
|
const hasAnyLink = shares.some((share) => share.share_type === NC_SHARE_TYPE.LINK)
|
|
if (hasAnyLink) return "users"
|
|
|
|
return "lock"
|
|
}
|