Skip to content
Merged
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
152 changes: 144 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
"pane-registry": "5.0.2-1",
"profile-pane": "4.1.0-0",
"rdflib": "2.4.1",
"solid-logic": "6.0.1-4",
"solid-logic": "6.0.1-5",
"solid-namespace": "^0.5.4",
"solid-ui": "5.0.2-3",
"solid-ui": "5.0.2-4",
"source-pane": "4.0.1-0"
},
"overrides": {
Expand Down
7 changes: 6 additions & 1 deletion src/navigation/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ export function deriveExplorerHeader (input: ExplorerHeaderInput): boolean {
* The header is never shown over a person's profile or friends, whatever the resource,
* nor over a storage view, which has its own header or the navbar.
*/
export function explorerHeaderForPane (resourceHeader: boolean, paneName?: string, folderView?: FolderView): boolean {
export function explorerHeaderForPane (
resourceHeader: boolean,
paneName?: string,
folderView?: FolderView,
solo = false
): boolean {
if (paneName === 'folder' && (folderView === 'explorer' || folderView === 'storage')) return false
return resourceHeader && !isPersonPane(paneName)
}
12 changes: 2 additions & 10 deletions src/outline/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

// Represent an object in summary form as a content block

function appendRemoveIcon (node, subject, removeNode) {

Check warning on line 129 in src/outline/manager.js

View workflow job for this annotation

GitHub Actions / build (24)

'appendRemoveIcon' is defined but never used

Check warning on line 129 in src/outline/manager.js

View workflow job for this annotation

GitHub Actions / build (22)

'appendRemoveIcon' is defined but never used
const image = UI.utils.AJARImage(
outlineIcons.src.icon_remove_node,
'remove',
Expand Down Expand Up @@ -259,14 +259,6 @@
})
}

function getPane (relevantPanes, subject) {
return (
relevantPanes.find(
pane => pane.shouldGetFocus && pane.shouldGetFocus(subject)
) || relevantPanes[0]
)
}

function setQueryButtonVisibility (shouldShow) {
const queryButton = dom.getElementById('queryButton')
if (!queryButton) return
Expand Down Expand Up @@ -313,7 +305,7 @@
subjectUri: subject.uri,
pane,
relevantPanes: provider.relevantPanes || [],
header: state && explorerHeaderForPane(state.showHeader, pane?.name, state.options.folderView)
header: state && explorerHeaderForPane(state.showHeader, pane?.name, state.options.folderView, state.options.solo)
? { paneIcon: getPaneIcon(pane, subject, context), menuItems: state.menuItems }
: undefined,
paneElement
Expand Down Expand Up @@ -403,7 +395,7 @@
}

provider.relevantPanes = relevantPanes
provider.pane = requiredPane || getPane(relevantPanes, subject)
provider.pane = requiredPane || UI.getPreferredPane(subject, context, relevantPanes)
const isRootResource = !!(subject && subject.uri && subject.site && subject.site().uri === subject.uri)
const viewerPodOnly = !!options.headerOnlyInViewerPod
const showHeader = !subject.uri.endsWith('/index.ttl#this') && deriveExplorerHeader({
Expand Down
2 changes: 1 addition & 1 deletion src/registerPanes.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export function registerPanes (register) {
register(audioPane) // Audio clip player

register(dokieliPane) // Should be above dataContentPane
register(slideshowPane) // Image containers should open in their specialized view
register(folderPane) // Should be above dataContentPane
register(classInstancePane) // Should be above dataContentPane
// register(require('./dynamic/dynamicPanes.js')) // warp etc warp broken 2017/8
register(slideshowPane)

register(socialPane)

Expand Down
27 changes: 15 additions & 12 deletions src/slideshow/slideshowPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
**
*/
import * as UI from 'solid-ui'
import { solidLogicSingleton } from 'solid-logic'

import makeBSS from '@solid/better-simple-slideshow'
const ns = UI.ns
let slideshowId = 0

export const slideshowPane = {
icon: UI.icons.iconBase + 'noun_138712.svg',
Expand All @@ -16,13 +18,11 @@ export const slideshowPane = {
// Does the subject deserve an slideshow pane?
label: function (subject, context) {
const store = context.session.store
const ns = UI.ns
const t = store.findTypeURIs(subject)
if (t[ns.ldp('Container').uri] || t[ns.ldp('BasicContainer').uri]) {
if (solidLogicSingleton.resource.isContainer(subject)) {
const contents = store.each(subject, ns.ldp('contains'))
let count = 0
contents.forEach(function (file) {
if (UI.widgets.isImage(file)) count++
if (solidLogicSingleton.resource.isImage(file)) count++
})
return count > 0 ? 'Slideshow' : null
}
Expand All @@ -40,18 +40,21 @@ export const slideshowPane = {
const store = context.session.store
const ns = UI.ns
const div = dom.createElement('div')
const id = `slideshow-${++slideshowId}`
div.id = id
div.setAttribute('class', 'bss-slides')

const t = store.findTypeURIs(subject)
let predicate
if (t[ns.ldp('BasicContainer').uri] || t[ns.ldp('Container').uri]) {
if (solidLogicSingleton.resource.isContainer(subject)) {
predicate = ns.ldp('contains')
}
const images = store.each(subject, predicate) // @@ random order?
const images = [...new Map(
store.each(subject, predicate).map(image => [image.uri, image])
).values()]
// @@ Ideally: sort by embedded time of image
images.sort() // Sort for now by URI
images.sort((left, right) => left.uri.localeCompare(right.uri))
for (let i = 0; i < images.length; i++) {
if (!UI.widgets.isImage(images[i])) continue
if (!solidLogicSingleton.resource.isImage(images[i])) continue
const figure = div.appendChild(dom.createElement('figure'))
const img = figure.appendChild(dom.createElement('img'))

Expand All @@ -69,9 +72,9 @@ export const slideshowPane = {
}
const options = { dom }

setTimeout(function () {
makeBSS('.bss-slides', options)
}, 1000) // Must run after the code which called this
dom.defaultView.requestAnimationFrame(function () {
makeBSS(`#${id}`, options)
})

return div
}
Expand Down
5 changes: 5 additions & 0 deletions test/unit/navigation/chrome.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ describe('file explorer header', () => {
// A pane opened in place of the folder keeps its resource header
expect(explorerHeaderForPane(true, 'source', 'explorer')).toBe(true)
})

it('retains the header for slideshow in solo and regular views', () => {
expect(explorerHeaderForPane(true, 'slideshow', undefined, true)).toBe(true)
expect(explorerHeaderForPane(true, 'slideshow')).toBe(true)
})
})

describe('storage view', () => {
Expand Down
1 change: 1 addition & 0 deletions test/unit/outline/manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ vi.mock('solid-ui', async () => {
return {
...actual,
getRelevantPanes: async (_subject, context) => context.session.paneRegistry.list,
getPreferredPane: (subject, _context, panes) => panes.find(pane => pane.shouldGetFocus?.(subject)) || panes[0],
login: {
...actual.login,
filterAvailablePanes: async panes => panes
Expand Down
Loading