Skip to content

Commit

Permalink
fix: various fixes + improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Sep 23, 2023
1 parent d51fc36 commit 4dcc939
Show file tree
Hide file tree
Showing 21 changed files with 1,647 additions and 1,069 deletions.
1 change: 0 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"editorconfig.editorconfig",
"lokalise.i18n-ally",
"mrmlnc.vscode-duplicate",
"mtxr.sqltools-driver-pg",
"mutantdino.resourcemonitor",
"wayou.vscode-todo-highlight",
"GraphQL.vscode-graphql"
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
image: postgres:16rc1
image: postgres:16
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
Expand Down
56 changes: 49 additions & 7 deletions blocks/block-index/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ export class BlockIndexElement extends LitElement {
padding: 0;
margin: 0;
list-style: none;
display: grid;
grid-auto-flow: row;
grid-template-columns: repeat(1, minmax(0, 1fr));
gap: 0.5rem;
}
@media (min-width: 1024px) {
ul {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
li {
Expand All @@ -28,6 +37,9 @@ export class BlockIndexElement extends LitElement {
padding: 0;
border-radius: 5px;
font-weight: 500;
display: flex;
align-items: stretch;
justify-content: stretch;
}
:host-context(body.body--dark) li {
background-color: #222;
Expand All @@ -47,15 +59,39 @@ export class BlockIndexElement extends LitElement {
background-image: linear-gradient(to bottom,#1e232a, #161b22);
border-left-color: var(--q-primary);
}
li + li {
margin-top: .5rem;
}
li a {
display: block;
display: flex;
color: var(--q-primary);
padding: 1rem;
text-decoration: none;
flex: 1;
flex-direction: column;
justify-content: center;
position: relative;
}
li a > span {
display: block;
color: #666;
font-size: .8em;
font-weight: normal;
pointer-events: none;
}
li a > svg {
width: 32px;
position: absolute;
right: 16px;
pointer-events: none;
}
li a > svg path {
fill: rgba(0,0,0,.2);
}
:host-context(body.body--dark) li a > svg path {
fill: rgba(255,255,255,.2);
}
li:hover a > svg path, :host-context(body.body--dark) li:hover a > svg path {
fill: color-mix(in srgb, currentColor 50%, transparent);
}
.no-links {
color: var(--q-negative);
border: 1px dashed color-mix(in srgb, currentColor 50%, transparent);
Expand Down Expand Up @@ -158,13 +194,19 @@ export class BlockIndexElement extends LitElement {
return this._pages.length > 0 || this._loading ? html`
<ul>
${this._pages.map(p =>
html`<li><a href="${p.href}" @click="${this._navigate}">${p.title}</a></li>`
html`<li>
<a href="${p.href}" @click="${this._navigate}">
${p.title}
${p.description ? html`<span>${p.description}</span>` : null}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48px" height="48px">
<path d="M 24 4 C 12.972292 4 4 12.972292 4 24 C 4 32.465211 9.2720863 39.722981 16.724609 42.634766 A 1.50015 1.50015 0 1 0 17.816406 39.841797 C 11.48893 37.369581 7 31.220789 7 24 C 7 14.593708 14.593708 7 24 7 A 1.50015 1.50015 0 1 0 24 4 z M 32.734375 6.1816406 A 1.50015 1.50015 0 0 0 32.033203 9.0136719 C 37.368997 11.880008 41 17.504745 41 24 C 41 33.406292 33.406292 41 24 41 A 1.50015 1.50015 0 1 0 24 44 C 35.027708 44 44 35.027708 44 24 C 44 16.385255 39.733331 9.7447579 33.453125 6.3710938 A 1.50015 1.50015 0 0 0 32.734375 6.1816406 z M 25.484375 16.484375 A 1.50015 1.50015 0 0 0 24.439453 19.060547 L 27.878906 22.5 L 16.5 22.5 A 1.50015 1.50015 0 1 0 16.5 25.5 L 27.878906 25.5 L 24.439453 28.939453 A 1.50015 1.50015 0 1 0 26.560547 31.060547 L 32.560547 25.060547 A 1.50015 1.50015 0 0 0 32.560547 22.939453 L 26.560547 16.939453 A 1.50015 1.50015 0 0 0 25.484375 16.484375 z"/>
</svg>
</a>
</li>`
)}
</ul>
<slot></slot>
` : html`
<div class="no-links">${this.noResultMsg}</div>
<slot></slot>
`
}

Expand Down
3 changes: 3 additions & 0 deletions blocks/block-index/tree.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ query blockIndexFetchPages (
folderPath
fileName
title
...on TreeItemPage {
description
}
}
}
2 changes: 1 addition & 1 deletion dev/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN mkdir -p /wiki && \
WORKDIR /wiki

COPY --chown=node:node ./assets ./assets
COPY --chown=node:node ./blocks/dist ./blocks/dist
COPY --chown=node:node ./blocks/compiled ./blocks/compiled
COPY --chown=node:node ./server ./server
COPY --chown=node:node ./dev/build/config.yml ./config.yml
COPY --chown=node:node ./LICENSE ./LICENSE
Expand Down
8 changes: 4 additions & 4 deletions server/graph/resolvers/storage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default {
}
// await WIKI.db.storage.initTargets()
return {
status: generateSuccess('Storage targets updated successfully')
operation: generateSuccess('Storage targets updated successfully')
}
} catch (err) {
return generateError(err)
Expand All @@ -186,7 +186,7 @@ export default {
const result = await WIKI.storage.modules[md.key].setup(args.targetId, args.state)

return {
status: generateSuccess('Storage target setup step succeeded'),
operation: generateSuccess('Storage target setup step succeeded'),
state: result
}
} catch (err) {
Expand All @@ -209,7 +209,7 @@ export default {
await WIKI.storage.modules[md.key].setupDestroy(args.targetId)

return {
status: generateSuccess('Storage target setup configuration destroyed succesfully.')
operation: generateSuccess('Storage target setup configuration destroyed succesfully.')
}
} catch (err) {
return generateError(err)
Expand All @@ -219,7 +219,7 @@ export default {
try {
await WIKI.db.storage.executeAction(args.targetKey, args.handler)
return {
status: generateSuccess('Action completed.')
operation: generateSuccess('Action completed.')
}
} catch (err) {
return generateError(err)
Expand Down
3 changes: 3 additions & 0 deletions server/graph/resolvers/tree.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export default {
fileSize: item.meta?.fileSize || 0,
fileExt: item.meta?.fileExt || '',
mimeType: item.meta?.mimeType || ''
},
...(item.type === 'page') && {
description: item.meta?.description || ''
}
}))
},
Expand Down
1 change: 1 addition & 0 deletions server/graph/schemas/tree.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type TreeItemPage implements TreeItem {
editor: String
pageType: String
title: String
description: String
updatedAt: Date
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { Octokit, App } = require('octokit')
import { Octokit, App } from 'octokit'

module.exports = {
export default {
async activated () { },
async deactivated () { },
async init () { },
Expand Down
Loading

0 comments on commit 4dcc939

Please sign in to comment.