-
Notifications
You must be signed in to change notification settings - Fork 52
Fix bugs and improve styling/mobile for release #737
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
Changes from 5 commits
8d631da
bc3ad6b
fe40f18
58393ee
35eba13
b266d3e
b225e8b
5ac0174
f669922
1c2626b
f9003df
9c1cb57
53c195f
99869a3
128a511
39a605c
34906ed
838cb04
50d5916
3e0c80d
cda1e87
9576821
6859c65
8794bc4
e26df5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,9 @@ import { PaneIcon } from './types' | |
| import '~icons/lucide/globe' | ||
| import '~icons/lucide/lock-keyhole' | ||
| import '~icons/lucide/arrow-left' | ||
| import '~icons/lucide/folder' | ||
| import styles from './FileExplorerHeaderSummary.styles.css' | ||
| import { type FileExplorerResourceMetadata } from './helper' | ||
| import { getContainerItemCount, isContainerSubject, type FileExplorerResourceMetadata } from './helper' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in solid-panes we have, brand new, a podUtils unders utils... O believe some functions and logic is now duplicate and yes, it should be in solid-logic actually. We can consolidate later ioni worst case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I'll leave this for now, but my next PR for the 3 dots menu already uses the resource service from solid-logic. I was just trying to keep this simple for the release and also at the time I wasn't sure you agreed with the resource service. |
||
|
|
||
| @customElement('file-explorer-header-summary') | ||
| export default class FileExplorerHeaderSummary extends WebComponent { | ||
|
|
@@ -93,11 +94,41 @@ export default class FileExplorerHeaderSummary extends WebComponent { | |
| } | ||
| } | ||
|
|
||
| private renderContainerResourceHeader (label: string, isPublic: boolean) { | ||
| const itemCount = getContainerItemCount(this.fileExplorerContext?.store, this.fileExplorerContext?.subjectUri) ?? 0 | ||
| return html` | ||
| <div class="container-info"> | ||
| <h1> | ||
| <span>${label}</span> | ||
| </h1> | ||
| <p> | ||
| ${itemCount} items | ||
| ${isPublic | ||
| ? html`<span class="public"><icon-lucide-globe></icon-lucide-globe></span>` | ||
| : html`<span class="private"><icon-lucide-lock-keyhole></icon-lucide-lock-keyhole></span>`} | ||
| </p> | ||
| </div> | ||
| ` | ||
| } | ||
|
|
||
| private renderResourceHeader (label: string, isPublic: boolean) { | ||
| const modified = this.formatModifiedDate(this.responseMetadata.modified) | ||
|
|
||
| return html` | ||
| <div class="resource-info"> | ||
| <h1> | ||
| <span>${label}</span> | ||
| </h1> | ||
| <p><span class="resource-date">${modified}</span> ${isPublic ? html`<span class="public"><icon-lucide-globe></icon-lucide-globe> Public</span>` : html`<span class="private"><icon-lucide-lock-keyhole></icon-lucide-lock-keyhole> Private</span>`}</p> | ||
| </div> | ||
| ` | ||
| } | ||
|
|
||
| render () { | ||
| const subject = this.fileExplorerContext?.subjectUri ? sym(this.fileExplorerContext.subjectUri) : undefined | ||
| const label = subject ? utils.label(subject) : '' | ||
| const modified = this.formatModifiedDate(this.responseMetadata.modified) | ||
| const isPublic = this.responseMetadata.isPublic | ||
| const isContainerResource = isContainerSubject(this.fileExplorerContext?.store, this.fileExplorerContext?.subjectUri) | ||
|
|
||
| return html` | ||
| <div class="file-explorer-header-summary"> | ||
|
|
@@ -111,10 +142,8 @@ export default class FileExplorerHeaderSummary extends WebComponent { | |
| <span class="pane-icon"> | ||
| ${this.resolvedPaneIcon ? html`<img src=${this.resolvedPaneIcon} alt="" />` : ''} | ||
| </span> | ||
| <div> | ||
| <h1>${label}</h1> | ||
| <p>${modified} ${isPublic ? html`<span class="public"><icon-lucide-globe></icon-lucide-globe> Public</span>` : html`<span class="private"><icon-lucide-lock-keyhole></icon-lucide-lock-keyhole> Private</span>`}</p> | ||
| </div> | ||
| ${isContainerResource ? this.renderContainerResourceHeader(label, isPublic) : this.renderResourceHeader(label, isPublic)} | ||
| </div> | ||
| </div> | ||
| ` | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,25 @@ export type FileExplorerResourceMetadata = { | |
| modified: string | undefined | ||
| } | ||
|
|
||
| export function isContainerSubject (store: LiveStore | undefined, subjectUri: string | undefined): boolean { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could at least move it to podUtils for now |
||
| if (!store || !subjectUri) return false | ||
|
|
||
| const subject = store.sym(subjectUri) | ||
| const typeUris = store.findTypeURIs(subject) | ||
| return Boolean( | ||
| typeUris[ns.ldp('Container').uri] || | ||
| typeUris[ns.ldp('BasicContainer').uri] || | ||
| subject.uri.endsWith('/') | ||
| ) | ||
| } | ||
|
|
||
| export function getContainerItemCount (store: LiveStore | undefined, subjectUri: string | undefined): number { | ||
| if (!store || !subjectUri) return 0 | ||
|
|
||
| const subject = store.sym(subjectUri) | ||
| return store.each(subject, ns.ldp('contains')).length | ||
| } | ||
|
|
||
| function parseWacAllowHeader (headerValue: string | null | undefined) { | ||
| const permissions = new Map<string, Set<string>>() | ||
| if (!headerValue) return permissions | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| :host { | ||
| .ellipsisIcon { | ||
| width: 16px; | ||
| height: 16px; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this watchMedia is interesting but I believe this is where maybe we should work with the pane-registry environment. For this release, this is fine for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree, and perhaps move that profile-pane logic. I'll create a ticket.