Remove boardspage
This commit is contained in:
parent
42d3d657c6
commit
d8f686ac42
3 changed files with 8 additions and 164 deletions
|
@ -1,29 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
|
||||
<link rel="stylesheet" href="/main.css">
|
||||
<link rel="stylesheet" href="/images.css">
|
||||
<link rel="stylesheet" href="/colors.css">
|
||||
|
||||
<script>
|
||||
window.location.href = "/boards"
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="container">
|
||||
<header id="header">
|
||||
<a href="/">OCTO</a>
|
||||
</header>
|
||||
|
||||
<main id="main">
|
||||
<p>
|
||||
<a href="boards">All Boards</a>
|
||||
</p>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,112 +0,0 @@
|
|||
import { Archiver } from "./archiver"
|
||||
import { Board } from "./board"
|
||||
import { Mutator } from "./mutator"
|
||||
import { OctoClient } from "./octoClient"
|
||||
import { UndoManager } from "./undomanager"
|
||||
import { Utils } from "./utils"
|
||||
|
||||
class BoardsPage {
|
||||
boardsPanel: HTMLElement
|
||||
|
||||
boardId: string
|
||||
boards: Board[]
|
||||
|
||||
octo = new OctoClient()
|
||||
|
||||
constructor() {
|
||||
// This is a placeholder page
|
||||
|
||||
const root = Utils.getElementById("octo-tasks-app")
|
||||
root.innerText = ""
|
||||
|
||||
// Header
|
||||
root.appendChild(Utils.htmlToElement(`<div class="page-header"><a href="/">OCTO</a></div`))
|
||||
|
||||
const mainPanel = root.appendChild(document.createElement("div"))
|
||||
|
||||
this.boardsPanel = mainPanel.appendChild(document.createElement("div"))
|
||||
|
||||
{
|
||||
const addButton = document.body.appendChild(document.createElement("div"))
|
||||
addButton.className = "octo-button"
|
||||
addButton.innerText = "+ Add Board"
|
||||
addButton.onclick = () => { this.addClicked() }
|
||||
}
|
||||
|
||||
document.body.appendChild(document.createElement("br"))
|
||||
|
||||
{
|
||||
const importButton = document.body.appendChild(document.createElement("div"))
|
||||
importButton.className = "octo-button"
|
||||
importButton.innerText = "Import archive"
|
||||
importButton.onclick = async () => {
|
||||
const octo = new OctoClient()
|
||||
const mutator = new Mutator(octo, UndoManager.shared)
|
||||
Archiver.importFullArchive(mutator, () => {
|
||||
this.updateView()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const exportButton = document.body.appendChild(document.createElement("div"))
|
||||
exportButton.className = "octo-button"
|
||||
exportButton.innerText = "Export archive"
|
||||
exportButton.onclick = () => {
|
||||
const octo = new OctoClient()
|
||||
const mutator = new Mutator(octo, UndoManager.shared)
|
||||
Archiver.exportFullArchive(mutator)
|
||||
}
|
||||
}
|
||||
|
||||
this.updateView()
|
||||
}
|
||||
|
||||
async getBoardData() {
|
||||
const boards = this.octo.getBlocks(null, "board")
|
||||
}
|
||||
|
||||
async updateView() {
|
||||
const { boardsPanel } = this
|
||||
|
||||
boardsPanel.innerText = ""
|
||||
|
||||
const boards = await this.octo.getBlocks(null, "board")
|
||||
for (const board of boards) {
|
||||
const p = boardsPanel.appendChild(document.createElement("p"))
|
||||
const a = p.appendChild(document.createElement("a"))
|
||||
a.style.padding = "5px 10px"
|
||||
a.style.fontSize = "20px"
|
||||
a.href = `./board?id=${encodeURIComponent(board.id)}`
|
||||
|
||||
if (board.icon) {
|
||||
const icon = a.appendChild(document.createElement("span"))
|
||||
icon.className = "octo-icon"
|
||||
icon.style.marginRight = "10px"
|
||||
icon.innerText = board.icon
|
||||
}
|
||||
|
||||
const title = a.appendChild(document.createElement("b"))
|
||||
const updatedDate = new Date(board.updateAt)
|
||||
title.innerText = board.title
|
||||
const details = a.appendChild(document.createElement("span"))
|
||||
details.style.fontSize = "15px"
|
||||
details.style.color = "#909090"
|
||||
details.style.marginLeft = "10px"
|
||||
details.innerText = ` ${Utils.displayDate(updatedDate)}`
|
||||
}
|
||||
|
||||
console.log(`updateView: ${boards.length} board(s).`)
|
||||
}
|
||||
|
||||
async addClicked() {
|
||||
const board = new Board()
|
||||
await this.octo.insertBlock(board)
|
||||
await this.updateView()
|
||||
}
|
||||
}
|
||||
|
||||
export = BoardsPage
|
||||
|
||||
const _ = new BoardsPage()
|
||||
console.log("boardsView")
|
|
@ -1,9 +1,9 @@
|
|||
const webpack = require("webpack");
|
||||
const path = require("path");
|
||||
const CopyPlugin = require("copy-webpack-plugin");
|
||||
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const webpack = require("webpack")
|
||||
const path = require("path")
|
||||
const CopyPlugin = require("copy-webpack-plugin")
|
||||
var HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
|
||||
const outpath = path.resolve(__dirname, "pack");
|
||||
const outpath = path.resolve(__dirname, "pack")
|
||||
|
||||
function makeCommonConfig() {
|
||||
const commonConfig = {
|
||||
|
@ -47,20 +47,6 @@ function makeCommonConfig() {
|
|||
{ from: path.resolve(__dirname, "node_modules/easymde/dist/easymde.min.css"), to: "static" },
|
||||
],
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
inject: true,
|
||||
title: "OCTO",
|
||||
chunks: [],
|
||||
template: "html-templates/index.ejs",
|
||||
filename: 'index.html'
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
inject: true,
|
||||
title: "OCTO - Boards",
|
||||
chunks: ["boardsPage"],
|
||||
template: "html-templates/page.ejs",
|
||||
filename: 'boards.html'
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
inject: true,
|
||||
title: "OCTO",
|
||||
|
@ -70,16 +56,15 @@ function makeCommonConfig() {
|
|||
}),
|
||||
],
|
||||
entry: {
|
||||
boardsPage: "./src/client/boardsPage.ts",
|
||||
boardPage: "./src/client/boardPage.tsx"
|
||||
},
|
||||
output: {
|
||||
filename: "[name].js",
|
||||
path: outpath
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return commonConfig;
|
||||
return commonConfig
|
||||
}
|
||||
|
||||
module.exports = makeCommonConfig;
|
||||
module.exports = makeCommonConfig
|
||||
|
|
Loading…
Reference in a new issue