-
Notifications
You must be signed in to change notification settings - Fork 3
Feature Header #211
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
Merged
Merged
Feature Header #211
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fa9ef09
rename editor card
SharonStrats 1ad242f
header
SharonStrats f399888
merge with staging
SharonStrats 94f2d8e
refactor provider, editor, and header
SharonStrats f6fdceb
chore: update solidos dependencies (dev: solid-logic@4.0.8-1 pane-reg…
github-actions[bot] 0ae25b1
additional refactor and fix tests
SharonStrats c23fb69
chore: update solidos dependencies (dev: solid-logic@4.0.8-1 pane-reg…
github-actions[bot] 98c877e
additional refactor and fix tests
SharonStrats ef1a829
update version
SharonStrats File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| /// <reference types="vite-plugin-lit-css/client" /> | ||
| /// <reference types="unplugin-icons/types/web-components" /> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| :host { | ||
| header { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| gap: 6px; | ||
| flex-wrap: nowrap; | ||
| width: 100%; | ||
| text-align: right; | ||
| padding: 15px; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { WebComponent } from 'solid-ui' | ||
| import { customElement } from 'lit/decorators.js' | ||
| import { html } from 'lit' | ||
| import 'solid-ui/components/button' | ||
| import { consume } from '@lit/context' | ||
| import { sourceContext, SourceContext } from '../../primitives/context' | ||
| import '~icons/lucide/share-2' | ||
| import '~icons/lucide/pencil' | ||
| import '~icons/lucide/ellipsis-vertical' | ||
| import styles from './SourceHeader.styles.css' | ||
| import './SourceHeaderSummary' | ||
| import './SourceHeaderControls' | ||
|
|
||
| @customElement('source-pane-source-header') | ||
| export default class SourceHeader extends WebComponent { | ||
| static styles = styles | ||
|
|
||
| @consume({ context: sourceContext, subscribe: true }) | ||
| accessor sourceContext: SourceContext = undefined as unknown as SourceContext | ||
|
|
||
| render () { | ||
| return html` | ||
| <header> | ||
| <source-pane-source-header-summary></source-pane-source-header-summary> | ||
| <source-pane-source-header-controls></source-pane-source-header-controls> | ||
| </header> | ||
| ` | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| :host { | ||
| div { | ||
| display: flex; | ||
| justify-content: flex-end; | ||
| align-items: center; | ||
| gap: 6px; | ||
| flex: 0 0 auto; | ||
| text-align: right; | ||
| } | ||
|
|
||
| /* generative ai */ | ||
| div > * { | ||
| flex: 0 1 auto; | ||
| } | ||
|
|
||
| @media (max-width: 900px) { | ||
| div { | ||
| padding-right: 3px; | ||
| } | ||
| } | ||
|
|
||
| @media (max-width: 600px) { | ||
| div { | ||
| justify-content: flex-start; | ||
| gap: 5px; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import { WebComponent } from 'solid-ui' | ||
| import { customElement } from 'lit/decorators.js' | ||
| import { html } from 'lit' | ||
| import 'solid-ui/components/button' | ||
| import { consume } from '@lit/context' | ||
| import { sourceContext, SourceContext } from '../../primitives/context' | ||
| import '~icons/lucide/share-2' | ||
| import '~icons/lucide/pencil' | ||
| import '~icons/lucide/ellipsis-vertical' | ||
| import styles from './SourceHeaderControls.styles.css' | ||
| import './SourceHeaderSummary' | ||
|
|
||
| @customElement('source-pane-source-header-controls') | ||
| export default class SourceHeaderControls extends WebComponent { | ||
| static styles = styles | ||
|
|
||
| @consume({ context: sourceContext, subscribe: true }) | ||
| accessor sourceContext: SourceContext = undefined as unknown as SourceContext | ||
|
|
||
| /* private canEditSource (subject: NamedNode, sourcePaneState: SourcePaneState) { | ||
| const { allowed } = sourcePaneState | ||
| return !subject.uri.endsWith('/') && (!allowed || allowed.includes('PUT')) | ||
| } */ | ||
|
|
||
| private setEditable() { | ||
| const sourcePaneState = this.sourceContext?.sourcePaneState | ||
| if (!sourcePaneState || sourcePaneState.broken) return | ||
| this.sourceContext?.setEditing?.() | ||
| } | ||
|
|
||
| render () { | ||
| return html` | ||
| <div> | ||
| <solid-ui-button class="sourcePanePrettyButton" variant="ghost" title="Share"> | ||
| <icon-lucide-share-2 slot="icon"></icon-lucide-share-2> | ||
| </solid-ui-button> | ||
| <solid-ui-button class="sourcePanePrettyButton" variant="ghost" @click=${() => this.setEditable()}> | ||
| <icon-lucide-pencil slot="icon"></icon-lucide-pencil> | ||
| </solid-ui-button> | ||
| <solid-ui-button class="sourcePanePrettyButton" variant="ghost" title="More options"> | ||
| <icon-lucide-ellipsis-vertical slot="icon"></icon-lucide-ellipsis-vertical> | ||
| </solid-ui-button> | ||
| </div> | ||
| ` | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| :host { | ||
| .source-pane-header-summary { | ||
| display: flex; | ||
| justify-content: flex-start; | ||
| align-items: center; | ||
| gap: 6px; | ||
| flex-wrap: wrap; | ||
| flex: 1 1 auto; | ||
| min-width: 0; | ||
| text-align: left; | ||
| } | ||
|
|
||
| h1 { | ||
| color: var(--solid-ui-color-gray-700, #364153); | ||
| font-size: var(--solid-ui-font-size-2xl, 1.5rem); | ||
| font-weight: 500; | ||
| } | ||
|
|
||
| .source-pane-icon { | ||
| display: flex; | ||
| width: 40px; | ||
| height: 40px; | ||
| padding: 7.5px 7px 6.5px 7px; | ||
| justify-content: center; | ||
| align-items: center; | ||
| aspect-ratio: 1/1; | ||
| border-radius: 100px; | ||
| background: var(--slate-600, #45556C); | ||
| } | ||
|
|
||
| p { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 5px; | ||
| color: var(--solid-ui-gray-500, #6A7282); | ||
| font-size: var(--solid-ui-font-size-xs, .75rem); | ||
| font-weight: 500; | ||
| } | ||
|
|
||
| .source-pane-public { | ||
| display: flex; | ||
| padding: 2px 5px; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: 3px; | ||
| color: var(--blue-400, #51A2FF); | ||
| border-radius: 5px; | ||
| background: var(--blue-50, #EFF6FF); | ||
| } | ||
|
|
||
| icon-lucide-globe { | ||
| stroke-width: 1.021px; | ||
| stroke: var(--blue-400, #51A2FF); | ||
| } | ||
|
|
||
| .source-pane-private { | ||
| display: flex; | ||
| padding: 2px 5px; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: 3px; | ||
| color: var(--yellow-600, #D08700); | ||
| border-radius: 5px; | ||
| background: var(--yellow-100, #FEF9C2); | ||
| } | ||
|
|
||
| icon-lucide-lock-keyhole { | ||
| stroke-width: 1.021px; | ||
| stroke: var(--yellow-600, #D08700); | ||
| } | ||
|
|
||
| icon-lucide-globe, | ||
| icon-lucide-lock-keyhole { | ||
| width: 0.875rem; | ||
| height: 0.875rem; | ||
| } | ||
|
|
||
| icon-lucide-arrow-left { | ||
| width: 1.125rem; | ||
| height: 1.125rem; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import { utils, WebComponent } from 'solid-ui' | ||
| import 'solid-ui/components/button' | ||
| import { customElement } from 'lit/decorators.js' | ||
| import { html } from 'lit' | ||
| import { consume } from '@lit/context' | ||
| import { sym } from 'rdflib' | ||
| import { sourceContext, SourceContext } from '../../primitives/context' | ||
| import '~icons/lucide/globe' | ||
| import '~icons/lucide/lock-keyhole' | ||
| import '~icons/lucide/arrow-left' | ||
| import styles from './SourceHeaderSummary.styles.css' | ||
| import { sourcePaneIcon } from '../../icons/sourcePaneIcon' | ||
|
|
||
| @customElement('source-pane-source-header-summary') | ||
| export default class SourceHeaderSummary extends WebComponent { | ||
| static styles = styles | ||
|
|
||
| @consume({ context: sourceContext, subscribe: true }) | ||
| accessor sourceContext: SourceContext = undefined as unknown as SourceContext | ||
|
|
||
| private formatModifiedDate (modified: string | undefined) { | ||
| if (!modified) return '' | ||
|
|
||
| const date = new Date(modified) | ||
| if (Number.isNaN(date.getTime())) return modified | ||
|
|
||
| const parts = new Intl.DateTimeFormat('en-GB', { | ||
| day: '2-digit', | ||
| month: 'short', | ||
| year: 'numeric', | ||
| hour: '2-digit', | ||
| minute: '2-digit', | ||
| hour12: true | ||
| }).formatToParts(date) | ||
|
|
||
| const getPart = (type: Intl.DateTimeFormatPartTypes) => parts.find(part => part.type === type)?.value ?? '' | ||
| const day = getPart('day') | ||
| const month = getPart('month') | ||
| const year = getPart('year') | ||
| const hour = getPart('hour') | ||
| const minute = getPart('minute') | ||
| const dayPeriod = getPart('dayPeriod').toUpperCase() | ||
|
|
||
| return `${day} ${month}, ${year} at ${hour}:${minute} ${dayPeriod}` | ||
| } | ||
|
|
||
| render () { | ||
| const subject = this.sourceContext?.subject ? sym(this.sourceContext.subject) : undefined | ||
| const label = subject ? utils.label(subject) : '' | ||
| const modified = this.formatModifiedDate(this.sourceContext?.headerMetadata?.modified) | ||
| const isPublic = this.sourceContext?.headerMetadata?.isPublic ?? false | ||
|
|
||
| return html` | ||
| <div class="source-pane-header-summary"> | ||
| <solid-ui-button | ||
| variant="ghost"> | ||
| <icon-lucide-arrow-left></icon-lucide-arrow-left> | ||
| </solid-ui-button> | ||
| <span class="source-pane-icon">${sourcePaneIcon}</span> | ||
| <div> | ||
| <h1>${label}</h1> | ||
| <p>${modified} ${isPublic ? html`<span class="source-pane-public"><icon-lucide-globe></icon-lucide-globe> Public</span>` : html`<span class="source-pane-private"><icon-lucide-lock-keyhole></icon-lucide-lock-keyhole> Private</span>`}</p> | ||
| </div> | ||
| </div> | ||
| ` | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| flex-direction: column; | ||
| width: 100%; | ||
| align-items: stretch; | ||
| padding: 0px 40px; | ||
| } | ||
|
|
||
| .sourcePaneEditor { | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.