Compare commits
33 Commits
2ec52a78cf
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| baee3c43b9 | |||
| 0fb4f01892 | |||
| 94e2b8bd47 | |||
| 030060286f | |||
| b7ad2dc406 | |||
| 2023542229 | |||
| eaac266ebb | |||
| ed782f2fc6 | |||
| f2fd36664c | |||
| 456a0490a7 | |||
| 306dd8cabc | |||
| 50b3e421df | |||
| 963295e76b | |||
| e12b48b3e1 | |||
| b0509818b2 | |||
| ee553eae82 | |||
| 8c230d3596 | |||
| da3e015631 | |||
| f532152d57 | |||
| 818ae39e34 | |||
| 836f42be4d | |||
| 3fdced84bf | |||
| 139e7d0ef5 | |||
| ffb23b08eb | |||
| e6d66529e3 | |||
| 76bb9fbb30 | |||
| b928212608 | |||
| 329ed5adb0 | |||
| 7f48a725d8 | |||
| c7aac117c7 | |||
| 2b07cc98a6 | |||
| 475887420c | |||
| 9048bb0f11 |
@@ -13,9 +13,32 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
apt-get update -y && apt-get install -y openssh-client
|
||||||
|
apt-get install -y git
|
||||||
|
|
||||||
|
- name: Setup SSH inside container
|
||||||
|
run: |
|
||||||
|
rm -rf ~/.ssh
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.DEPLOY_KEY }}" | tr -d '\r' > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
|
||||||
|
# Add the container host to known_hosts
|
||||||
|
ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Log in to registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.aranroig.com -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||||
|
|
||||||
- name: Build frontend
|
- name: Build frontend
|
||||||
run: |
|
run: |
|
||||||
docker build -t git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-frontend:latest ./frontend
|
docker build -t git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-frontend:latest \
|
||||||
|
--build-arg NUXT_PUBLIC_GIT_COMMIT=$(git rev-parse --short HEAD) \
|
||||||
|
--build-arg NUXT_PUBLIC_GIT_TAG=$(git describe --tags --abbrev=0) \
|
||||||
|
--build-arg NUXT_PUBLIC_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
|
||||||
|
./frontend
|
||||||
docker push git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-frontend:latest
|
docker push git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-frontend:latest
|
||||||
|
|
||||||
- name: Build backend
|
- name: Build backend
|
||||||
@@ -23,17 +46,17 @@ jobs:
|
|||||||
docker build -t git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-backend:latest ./backend
|
docker build -t git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-backend:latest ./backend
|
||||||
docker push git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-backend:latest
|
docker push git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-backend:latest
|
||||||
|
|
||||||
# - name: Copy files
|
- name: Copy files
|
||||||
# run: |
|
run: |
|
||||||
# scp docker-compose.yml deploy@${{ secrets.DEPLOY_HOST}}:/var/www/app/
|
scp docker-compose.yml deploy@${{ secrets.DEPLOY_HOST}}:/var/www/app/
|
||||||
# scp nginx.conf deploy@${{ secrets.DEPLOY_HOST }}:/var/www/app/nginx.conf
|
scp nginx.conf deploy@${{ secrets.DEPLOY_HOST }}:/var/www/app/nginx.conf
|
||||||
|
|
||||||
#- name: Deploy
|
- name: Deploy
|
||||||
# run: |
|
run: |
|
||||||
# ssh deploy@${{ secrets.DEPLOY_HOST }} << 'EOF'
|
ssh deploy@${{ secrets.DEPLOY_HOST }} << 'EOF'
|
||||||
# echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.aranroig.com -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.aranroig.com -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||||
# cd /var/www/app/
|
cd /var/www/app/
|
||||||
# docker-compose pull
|
docker compose pull
|
||||||
# docker-compose up -d
|
docker compose up -d
|
||||||
# EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
2
backend/.gitignore
vendored
2
backend/.gitignore
vendored
@@ -14,3 +14,5 @@ logs
|
|||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.production
|
!.env.production
|
||||||
|
|
||||||
|
uploads/
|
||||||
13
backend/package-lock.json
generated
13
backend/package-lock.json
generated
@@ -19,7 +19,8 @@
|
|||||||
"mongoose": "^9.3.0",
|
"mongoose": "^9.3.0",
|
||||||
"multer": "^2.1.1",
|
"multer": "^2.1.1",
|
||||||
"nodemon": "^3.1.14",
|
"nodemon": "^3.1.14",
|
||||||
"passport": "^0.7.0"
|
"passport": "^0.7.0",
|
||||||
|
"passport-jwt": "^4.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mongodb-js/saslprep": {
|
"node_modules/@mongodb-js/saslprep": {
|
||||||
@@ -1256,6 +1257,16 @@
|
|||||||
"url": "https://github.com/sponsors/jaredhanson"
|
"url": "https://github.com/sponsors/jaredhanson"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/passport-jwt": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/passport-jwt/-/passport-jwt-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-UCKMDYhNuGOBE9/9Ycuoyh7vP6jpeTp/+sfMJl7nLff/t6dps+iaeE0hhNkKN8/HZHcJ7lCdOyDxHdDoxoSvdQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"jsonwebtoken": "^9.0.0",
|
||||||
|
"passport-strategy": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/passport-strategy": {
|
"node_modules/passport-strategy": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz",
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
"mongoose": "^9.3.0",
|
"mongoose": "^9.3.0",
|
||||||
"multer": "^2.1.1",
|
"multer": "^2.1.1",
|
||||||
"nodemon": "^3.1.14",
|
"nodemon": "^3.1.14",
|
||||||
"passport": "^0.7.0"
|
"passport": "^0.7.0",
|
||||||
|
"passport-jwt": "^4.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ const express = require("express");
|
|||||||
const cors = require('cors');
|
const cors = require('cors');
|
||||||
const cookieParser = require('cookie-parser');
|
const cookieParser = require('cookie-parser');
|
||||||
const passport = require('passport');
|
const passport = require('passport');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
const dotenv = require('dotenv');
|
const dotenv = require('dotenv');
|
||||||
|
|
||||||
if(process.env.NODE_ENV) {
|
if(process.env.NODE_ENV) {
|
||||||
|
console.log(`.env.${process.env.NODE_ENV}`);
|
||||||
dotenv.config({
|
dotenv.config({
|
||||||
path: `.env.${process.env.NODE_ENV}`
|
path: `.env.${process.env.NODE_ENV}`
|
||||||
});
|
});
|
||||||
@@ -16,6 +18,11 @@ if(process.env.NODE_ENV) {
|
|||||||
const app = express();
|
const app = express();
|
||||||
const connectDB = require("./db");
|
const connectDB = require("./db");
|
||||||
|
|
||||||
|
|
||||||
|
// PUBLIC
|
||||||
|
const uploadDir = path.join(__dirname, 'uploads');
|
||||||
|
app.use('/api/public', express.static(uploadDir));
|
||||||
|
|
||||||
// JSON LIMIT EXPRESS
|
// JSON LIMIT EXPRESS
|
||||||
app.use(express.json({ limit: '50mb' }));
|
app.use(express.json({ limit: '50mb' }));
|
||||||
app.use(express.urlencoded({
|
app.use(express.urlencoded({
|
||||||
@@ -26,6 +33,10 @@ app.use(express.urlencoded({
|
|||||||
// connect database
|
// connect database
|
||||||
connectDB();
|
connectDB();
|
||||||
|
|
||||||
|
// MIDDLEWARE
|
||||||
|
app.use(passport.initialize());
|
||||||
|
require('./services/passport')(passport);
|
||||||
|
|
||||||
// CORS
|
// CORS
|
||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
|
|
||||||
@@ -35,13 +46,16 @@ app.use(cors({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// ROUTES (NO AUTH)
|
// ROUTES (NO AUTH)
|
||||||
app.use('/user', require('./routes/user'));
|
app.use('/api/user', require('./routes/user'));
|
||||||
|
|
||||||
// AUTH
|
// AUTH
|
||||||
checkAuth = passport.authenticate('jwt', { session: false });
|
checkAuth = passport.authenticate('jwt', { session: false });
|
||||||
app.use(checkAuth);
|
app.use(checkAuth);
|
||||||
|
|
||||||
// ROUTES WITH AUTH
|
// ROUTES WITH AUTH
|
||||||
|
app.use('/api/campaign', require('./routes/campaign'));
|
||||||
|
app.use('/api/note', require('./routes/note'));
|
||||||
|
app.use('/api/folder', require('./routes/folder'));
|
||||||
/*
|
/*
|
||||||
app.use('/campaign', require('./routes/campaign'));
|
app.use('/campaign', require('./routes/campaign'));
|
||||||
app.use('/maps', require('./routes/map'));
|
app.use('/maps', require('./routes/map'));
|
||||||
|
|||||||
17
backend/src/models/Campaign.js
Normal file
17
backend/src/models/Campaign.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
const mongoose = require("mongoose");
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
const CampaignSchema = new Schema({
|
||||||
|
name: {type: String, required: true},
|
||||||
|
description: {type: String},
|
||||||
|
color: {type: String},
|
||||||
|
createdBy: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: 'User',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
date: { type: Date, default: Date.now},
|
||||||
|
settings: { type: Object }
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = mongoose.model('Campaign', CampaignSchema);
|
||||||
18
backend/src/models/Folder.js
Normal file
18
backend/src/models/Folder.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
const mongoose = require('mongoose');
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
const FolderSchema = new Schema({
|
||||||
|
name: { type: String, required: true },
|
||||||
|
campaign: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: 'Campaign',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
parentFolder: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: 'Folder'
|
||||||
|
},
|
||||||
|
date: { type: Date, default: Date.now }
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = mongoose.model('Folder', FolderSchema);
|
||||||
19
backend/src/models/Note.js
Normal file
19
backend/src/models/Note.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
const mongoose = require('mongoose');
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
const NoteSchema = new Schema({
|
||||||
|
title: { type: String },
|
||||||
|
content: { type: String },
|
||||||
|
campaign: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: 'Campaign',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
folder: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: 'Folder'
|
||||||
|
},
|
||||||
|
date: { type: Date, default: Date.now }
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = mongoose.model('Note', NoteSchema);
|
||||||
46
backend/src/routes/campaign.js
Normal file
46
backend/src/routes/campaign.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
const express = require('express')
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
const Campaign = require("../models/Campaign");
|
||||||
|
|
||||||
|
router.post('/create', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { name, description, color, settings } = req.body;
|
||||||
|
const newCampaign = new Campaign({
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
color,
|
||||||
|
settings,
|
||||||
|
createdBy: req.user.id
|
||||||
|
});
|
||||||
|
await newCampaign.save();
|
||||||
|
res.json({ status: "ok", campaign: newCampaign });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: "error", msg: "errors.internal" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/list', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const campaigns = await Campaign.find({ createdBy: req.user.id });
|
||||||
|
res.json({ status: "ok", campaigns });
|
||||||
|
} catch (err) {
|
||||||
|
res.json({ status: "error", msg: "errors.internal", err });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/retrieve/:id', async (req, res) => {
|
||||||
|
try {
|
||||||
|
if (!req.user?.id) return res.status(401).json({ status: "error", msg: "errors.unauthorized" });
|
||||||
|
|
||||||
|
const campaign = await Campaign.findOne({ _id: req.params.id, createdBy: req.user.id });
|
||||||
|
if (!campaign) return res.json({ status: "error", msg: "errors.not-found" });
|
||||||
|
|
||||||
|
res.json({ status: "ok", campaign });
|
||||||
|
} catch (err) {
|
||||||
|
res.json({ status: "error", msg: "errors.internal", err });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
106
backend/src/routes/folder.js
Normal file
106
backend/src/routes/folder.js
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
const Campaign = require('../models/Campaign');
|
||||||
|
const Folder = require('../models/Folder');
|
||||||
|
const Note = require('../models/Note');
|
||||||
|
|
||||||
|
async function userOwnsCampaign(campaignId, userId) {
|
||||||
|
const campaign = await Campaign.findOne({ _id: campaignId, createdBy: userId }).lean();
|
||||||
|
return Boolean(campaign);
|
||||||
|
}
|
||||||
|
|
||||||
|
router.get('/list', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { campaign } = req.query;
|
||||||
|
if (!campaign) return res.json({ status: 'error', msg: 'errors.missing-data' });
|
||||||
|
|
||||||
|
const hasAccess = await userOwnsCampaign(campaign, req.user.id);
|
||||||
|
if (!hasAccess) return res.json({ status: 'error', msg: 'unauthorized' });
|
||||||
|
|
||||||
|
const folders = await Folder.find({ campaign })
|
||||||
|
.select('_id name date')
|
||||||
|
.sort({ date: -1 })
|
||||||
|
.lean();
|
||||||
|
|
||||||
|
res.json({ status: 'ok', folders });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: 'error', msg: 'errors.internal' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/create', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { name, campaign } = req.body;
|
||||||
|
if (!name || !campaign) return res.json({ status: 'error', msg: 'errors.missing-data' });
|
||||||
|
|
||||||
|
const hasAccess = await userOwnsCampaign(campaign, req.user.id);
|
||||||
|
if (!hasAccess) return res.json({ status: 'error', msg: 'unauthorized' });
|
||||||
|
|
||||||
|
const newFolder = new Folder({
|
||||||
|
name: name.trim(),
|
||||||
|
campaign
|
||||||
|
});
|
||||||
|
await newFolder.save();
|
||||||
|
res.json({ status: 'ok', folder: newFolder });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: 'error', msg: 'errors.internal' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/delete', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { id } = req.body;
|
||||||
|
if (!id) return res.json({ status: 'error', msg: 'errors.missing-data' });
|
||||||
|
|
||||||
|
const folder = await Folder.findById(id);
|
||||||
|
if (!folder) return res.json({ status: 'error', msg: 'errors.notfound' });
|
||||||
|
|
||||||
|
const hasAccess = await userOwnsCampaign(folder.campaign, req.user.id);
|
||||||
|
if (!hasAccess) return res.json({ status: 'error', msg: 'unauthorized' });
|
||||||
|
|
||||||
|
async function moveRecursive(folderId) {
|
||||||
|
const subfolders = await Folder.find({ parentFolder: folderId }).select('_id').lean();
|
||||||
|
await Note.updateMany(
|
||||||
|
{ folder: folderId },
|
||||||
|
{ $set: { folder: null, date: Date.now() } }
|
||||||
|
);
|
||||||
|
await Folder.deleteOne({ _id: folderId });
|
||||||
|
for (const sub of subfolders) {
|
||||||
|
await moveRecursive(sub._id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await moveRecursive(id);
|
||||||
|
|
||||||
|
res.json({ status: 'ok' });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: 'error', msg: 'errors.internal' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/rename', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { id, name } = req.body;
|
||||||
|
if (!id || !name) return res.json({ status: 'error', msg: 'errors.missing-data' });
|
||||||
|
|
||||||
|
const folder = await Folder.findById(id);
|
||||||
|
if (!folder) return res.json({ status: 'error', msg: 'errors.notfound' });
|
||||||
|
|
||||||
|
const hasAccess = await userOwnsCampaign(folder.campaign, req.user.id);
|
||||||
|
if (!hasAccess) return res.json({ status: 'error', msg: 'unauthorized' });
|
||||||
|
|
||||||
|
folder.name = name.trim();
|
||||||
|
await folder.save();
|
||||||
|
|
||||||
|
res.json({ status: 'ok', folder });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: 'error', msg: 'errors.internal' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
128
backend/src/routes/note.js
Normal file
128
backend/src/routes/note.js
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
const Campaign = require('../models/Campaign');
|
||||||
|
const Note = require('../models/Note');
|
||||||
|
const Folder = require('../models/Folder');
|
||||||
|
|
||||||
|
async function userOwnsCampaign(campaignId, userId) {
|
||||||
|
const campaign = await Campaign.findOne({ _id: campaignId, createdBy: userId }).lean();
|
||||||
|
return Boolean(campaign);
|
||||||
|
}
|
||||||
|
|
||||||
|
router.get('/list', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { campaign } = req.query;
|
||||||
|
if (!campaign) return res.json({ status: 'error', msg: 'errors.missing-data' });
|
||||||
|
|
||||||
|
const hasAccess = await userOwnsCampaign(campaign, req.user.id);
|
||||||
|
if (!hasAccess) return res.json({ status: 'error', msg: 'unauthorized' });
|
||||||
|
|
||||||
|
const folders = await Folder.find({ campaign })
|
||||||
|
.select('_id name date')
|
||||||
|
.sort({ date: -1 })
|
||||||
|
.lean();
|
||||||
|
|
||||||
|
const rootNotes = await Note.find({ campaign, folder: null })
|
||||||
|
.select('_id title content date')
|
||||||
|
.sort({ date: -1 })
|
||||||
|
.lean();
|
||||||
|
|
||||||
|
res.json({ status: 'ok', folders, notes: rootNotes });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: 'error', msg: 'errors.internal' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/subfolder/list', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { campaign, folder } = req.query;
|
||||||
|
if (!campaign || !folder) return res.json({ status: 'error', msg: 'errors.missing-data' });
|
||||||
|
|
||||||
|
const hasAccess = await userOwnsCampaign(campaign, req.user.id);
|
||||||
|
if (!hasAccess) return res.json({ status: 'error', msg: 'unauthorized' });
|
||||||
|
|
||||||
|
// Verify folder belongs to campaign
|
||||||
|
const folderDoc = await Folder.findOne({ _id: folder, campaign }).lean();
|
||||||
|
if (!folderDoc) return res.json({ status: 'error', msg: 'errors.notfound' });
|
||||||
|
|
||||||
|
const subfolders = await Folder.find({ campaign, parentFolder: folder })
|
||||||
|
.select('_id name date')
|
||||||
|
.sort({ date: -1 })
|
||||||
|
.lean();
|
||||||
|
|
||||||
|
const notes = await Note.find({ campaign, folder: folder })
|
||||||
|
.select('_id title content date')
|
||||||
|
.sort({ date: -1 })
|
||||||
|
.lean();
|
||||||
|
|
||||||
|
res.json({ status: 'ok', subfolders, notes });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: 'error', msg: 'errors.internal' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/create', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { title, content, campaign, folder } = req.body;
|
||||||
|
if (!title || !campaign) return res.json({ status: 'error', msg: 'errors.missing-data' });
|
||||||
|
|
||||||
|
const hasAccess = await userOwnsCampaign(campaign, req.user.id);
|
||||||
|
if (!hasAccess) return res.json({ status: 'error', msg: 'unauthorized' });
|
||||||
|
|
||||||
|
let effectiveFolder = null;
|
||||||
|
if (folder) {
|
||||||
|
const folderDoc = await Folder.findOne({ _id: folder, campaign }).lean();
|
||||||
|
if (!folderDoc) return res.json({ status: 'error', msg: 'errors.notfound' });
|
||||||
|
effectiveFolder = folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newNote = new Note({ title, content, campaign, folder: effectiveFolder });
|
||||||
|
await newNote.save();
|
||||||
|
res.json({ status: 'ok', note: newNote });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: 'error', msg: 'errors.internal' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/update', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { id, title, content, folder } = req.body;
|
||||||
|
if (!id) return res.json({ status: 'error', msg: 'errors.missing-data' });
|
||||||
|
|
||||||
|
const note = await Note.findById(id);
|
||||||
|
if (!note) return res.json({ status: 'error', msg: 'errors.notfound' });
|
||||||
|
|
||||||
|
const hasAccess = await userOwnsCampaign(note.campaign, req.user.id);
|
||||||
|
if (!hasAccess) return res.json({ status: 'error', msg: 'unauthorized' });
|
||||||
|
|
||||||
|
if (title !== undefined) note.title = title;
|
||||||
|
if (content !== undefined) note.content = content;
|
||||||
|
if (folder !== undefined) note.folder = folder;
|
||||||
|
await note.save();
|
||||||
|
res.json({ status: 'ok', note });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: 'error', msg: 'errors.internal' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/delete', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { id } = req.body;
|
||||||
|
if (!id) return res.json({ status: 'error', msg: 'errors.missing-data' });
|
||||||
|
|
||||||
|
const result = await Note.deleteOne({ _id: id });
|
||||||
|
if (result.deletedCount === 0) return res.json({ status: 'error', msg: 'errors.notfound' });
|
||||||
|
|
||||||
|
res.json({ status: 'ok' });
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
res.json({ status: 'error', msg: 'errors.internal' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -15,24 +15,44 @@ const User = require("../models/User");
|
|||||||
const upload = require("../services/storage");
|
const upload = require("../services/storage");
|
||||||
|
|
||||||
|
|
||||||
|
router.post('/register', async (req, res) => {
|
||||||
// Admin registers new user
|
|
||||||
router.post('/register', isAdmin, async (req, res) => {
|
|
||||||
try {
|
try {
|
||||||
let setupCode = crypto.randomBytes(64).toString('base64url');
|
const existsAdmin = !!(await User.findOne({ admin: true }));
|
||||||
|
const {
|
||||||
|
username,
|
||||||
|
email,
|
||||||
|
name,
|
||||||
|
password
|
||||||
|
} = req.body;
|
||||||
|
|
||||||
|
// Check if email or username already exists
|
||||||
|
const existingUser = await User.findOne({
|
||||||
|
$or: [
|
||||||
|
{ email: email },
|
||||||
|
{ username: username }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
if (existingUser) {
|
||||||
|
return res.json({
|
||||||
|
status: "error",
|
||||||
|
msg: "register.errors.email-username-exists"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const salt = await bcrypt.genSalt(10);
|
||||||
let user = new User({
|
let user = new User({
|
||||||
admin: false,
|
admin: !existsAdmin,
|
||||||
name: crypto.randomBytes(16).toString('base64url'),
|
name: name,
|
||||||
username: crypto.randomBytes(16).toString('base64url'),
|
username: username,
|
||||||
email: crypto.randomBytes(16).toString('base64url'),
|
email: email,
|
||||||
setupCode
|
password: await bcrypt.hash(password, salt)
|
||||||
});
|
});
|
||||||
|
|
||||||
await user.save();
|
await user.save();
|
||||||
res.json({ status: "ok", code: setupCode });
|
res.json({ status: "ok", code: setupCode });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
res.json({ status: "error", msg: "internal" });
|
res.json({ status: "error", msg: "errors.internal" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -85,21 +105,21 @@ router.post('/setup', rateLimitMiddleware, async (req, res) => {
|
|||||||
|
|
||||||
// Login post
|
// Login post
|
||||||
router.post('/login', rateLimitMiddleware, async (req, res) => {
|
router.post('/login', rateLimitMiddleware, async (req, res) => {
|
||||||
const { username, password } = req.body;
|
const { usermail, password } = req.body;
|
||||||
|
|
||||||
if (!(username && password)) {
|
if (!(usermail && password)) {
|
||||||
return res.json({ status: "error", msg: "params" });
|
return res.json({ status: "error", msg: "login.errors.params" });
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const user = await User.findOne({ username });
|
const user = await User.findOne({ $or: [{ username: usermail }, { email: usermail }] });
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return res.json({ status: "error", msg: "wrong" });
|
return res.json({ status: "error", msg: "login.errors.invalid-credentials" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const isMatch = await bcrypt.compare(password, user.password);
|
const isMatch = await bcrypt.compare(password, user.password);
|
||||||
if (!isMatch) {
|
if (!isMatch) {
|
||||||
return res.json({ status: "error", msg: "wrong" });
|
return res.json({ status: "error", msg: "login.errors.invalid-credentials" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
@@ -120,7 +140,7 @@ router.post('/login', rateLimitMiddleware, async (req, res) => {
|
|||||||
|
|
||||||
res.json({ status: "ok", token, msg: "success" });
|
res.json({ status: "ok", token, msg: "success" });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
res.json({ status: "error", msg: "internal" });
|
res.json({ status: "error", msg: "errors.internal" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -138,7 +158,7 @@ router.post("/upload-avatar", upload.single("image"), passport.authenticate('jwt
|
|||||||
router.get("/retrieve-avatar", async (req, res) => {
|
router.get("/retrieve-avatar", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const data = await User.findOne({ username: req.query.username });
|
const data = await User.findOne({ username: req.query.username });
|
||||||
res.json({ status: "ok", image: data.image });
|
res.json({ status: "ok", image: `${data.image}` });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
res.json({ status: "error" });
|
res.json({ status: "error" });
|
||||||
}
|
}
|
||||||
|
|||||||
25
backend/src/services/passport.js
Normal file
25
backend/src/services/passport.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
const JwtStrategy = require('passport-jwt').Strategy;
|
||||||
|
const ExtractJwt = require('passport-jwt').ExtractJwt;
|
||||||
|
|
||||||
|
const User = require('../models/User');
|
||||||
|
const key = require('./keys').secret;
|
||||||
|
|
||||||
|
const opts = {
|
||||||
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||||
|
secretOrKey: key
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = passport => {
|
||||||
|
passport.use(
|
||||||
|
new JwtStrategy(opts, async (jwt_payload, done) => {
|
||||||
|
try {
|
||||||
|
const user = await User.findById(jwt_payload._id);
|
||||||
|
if (user) return done(null, user);
|
||||||
|
return done(null, false);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
return done(err, false);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,14 +1,22 @@
|
|||||||
const multer = require('multer');
|
const multer = require('multer');
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const uploadDir = path.join(__dirname, '..', 'uploads'); // adjust if needed
|
||||||
|
|
||||||
|
if (!fs.existsSync(uploadDir)) {
|
||||||
|
fs.mkdirSync(uploadDir, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
var storage = multer.diskStorage({
|
var storage = multer.diskStorage({
|
||||||
destination: function (req, file, cb) {
|
destination: function (req, file, cb) {
|
||||||
cb(null, 'uploads')
|
cb(null, uploadDir);
|
||||||
},
|
},
|
||||||
filename: function (req, file, cb) {
|
filename: function (req, file, cb) {
|
||||||
cb(null, file.fieldname + '-' + Date.now())
|
const ext = path.extname(file.originalname);
|
||||||
|
cb(null, file.fieldname + '-' + Date.now() + ext);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var upload = multer({storage: storage});
|
var upload = multer({storage: storage});
|
||||||
module.exports = upload;
|
module.exports = upload;
|
||||||
|
|
||||||
21
docker-compose.yml
Normal file
21
docker-compose.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:latest
|
||||||
|
ports:
|
||||||
|
- "3000:80"
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
depends_on:
|
||||||
|
- frontend
|
||||||
|
- backend
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: git.aranroig.com/syndria98/dragonroll-frontend:latest
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
backend:
|
||||||
|
image: git.aranroig.com/syndria98/dragonroll-backend:latest
|
||||||
|
restart: always
|
||||||
1
frontend/.env.production
Normal file
1
frontend/.env.production
Normal file
@@ -0,0 +1 @@
|
|||||||
|
NUXT_PUBLIC_API_BASE_URL=https://dragonroll.aranroig.com/api
|
||||||
2
frontend/.gitignore
vendored
2
frontend/.gitignore
vendored
@@ -21,4 +21,4 @@ logs
|
|||||||
# Local env files
|
# Local env files
|
||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.production
|
||||||
@@ -1,6 +1,14 @@
|
|||||||
# ---------- Build Stage ----------
|
# ---------- Build Stage ----------
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
|
ARG NUXT_PUBLIC_GIT_COMMIT
|
||||||
|
ARG NUXT_PUBLIC_GIT_TAG
|
||||||
|
ARG NUXT_PUBLIC_GIT_BRANCH
|
||||||
|
|
||||||
|
ENV NUXT_PUBLIC_GIT_COMMIT=$NUXT_PUBLIC_GIT_COMMIT
|
||||||
|
ENV NUXT_PUBLIC_GIT_TAG=$NUXT_PUBLIC_GIT_TAG
|
||||||
|
ENV NUXT_PUBLIC_GIT_BRANCH=$NUXT_PUBLIC_GIT_BRANCH
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files
|
# Copy package files
|
||||||
|
|||||||
@@ -1,75 +1,19 @@
|
|||||||
# Nuxt Minimal Starter
|
# Frontend
|
||||||
|
|
||||||
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
|
This folder contains the React frontend for Dragonroll, an open-source role-playing game helper.
|
||||||
|
|
||||||
## Setup
|
## Features
|
||||||
|
|
||||||
Make sure to install dependencies:
|
- Campaign management with character tracking
|
||||||
|
- Player note sharing (markdown)
|
||||||
|
- Audio for in-person campaigns
|
||||||
|
- Encounter planning
|
||||||
|
- Item and spell management
|
||||||
|
|
||||||
```bash
|
## Files
|
||||||
# npm
|
|
||||||
npm install
|
|
||||||
|
|
||||||
# pnpm
|
- `app/` - Application components and services
|
||||||
pnpm install
|
- `app/services/` - Frontend services (Campaign, User, Window, etc.)
|
||||||
|
- Styling and React components
|
||||||
|
|
||||||
# yarn
|
See the main README for complete information.
|
||||||
yarn install
|
|
||||||
|
|
||||||
# bun
|
|
||||||
bun install
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development Server
|
|
||||||
|
|
||||||
Start the development server on `http://localhost:3000`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# npm
|
|
||||||
npm run dev
|
|
||||||
|
|
||||||
# pnpm
|
|
||||||
pnpm dev
|
|
||||||
|
|
||||||
# yarn
|
|
||||||
yarn dev
|
|
||||||
|
|
||||||
# bun
|
|
||||||
bun run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## Production
|
|
||||||
|
|
||||||
Build the application for production:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# npm
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# pnpm
|
|
||||||
pnpm build
|
|
||||||
|
|
||||||
# yarn
|
|
||||||
yarn build
|
|
||||||
|
|
||||||
# bun
|
|
||||||
bun run build
|
|
||||||
```
|
|
||||||
|
|
||||||
Locally preview production build:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# npm
|
|
||||||
npm run preview
|
|
||||||
|
|
||||||
# pnpm
|
|
||||||
pnpm preview
|
|
||||||
|
|
||||||
# yarn
|
|
||||||
yarn preview
|
|
||||||
|
|
||||||
# bun
|
|
||||||
bun run preview
|
|
||||||
```
|
|
||||||
|
|
||||||
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
|
|
||||||
|
|||||||
@@ -4,13 +4,39 @@ import ToastManager from './components/managers/ToastManager.vue';
|
|||||||
import WindowManager from './components/managers/WindowManager.vue';
|
import WindowManager from './components/managers/WindowManager.vue';
|
||||||
|
|
||||||
import { CreateWindow } from '@/services/Windows'
|
import { CreateWindow } from '@/services/Windows'
|
||||||
|
import { GetUser, HasAdmin } from './services/User';
|
||||||
|
import TooltipManager from './components/managers/TooltipManager.vue';
|
||||||
|
import ContextMenuManager from './components/managers/ContextMenuManager.vue';
|
||||||
|
import { useCampaignService } from './services/Campaign';
|
||||||
|
|
||||||
|
const { RestoreCampaign } = useCampaignService();
|
||||||
|
|
||||||
async function start(){
|
async function start(){
|
||||||
CreateWindow('login');
|
if(GetUser()){
|
||||||
|
const restoredCampaign = await RestoreCampaign();
|
||||||
|
if (!restoredCampaign) {
|
||||||
|
CreateWindow('main_menu');
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(await HasAdmin()){
|
||||||
|
CreateWindow('login');
|
||||||
|
} else {
|
||||||
|
CreateWindow('register', {firstTime: true});
|
||||||
|
}
|
||||||
// DisplayToast('aqua', 'All plugins loaded successfully');
|
// DisplayToast('aqua', 'All plugins loaded successfully');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Dragonroll',
|
||||||
|
meta: [
|
||||||
|
{ name: 'description', content: 'Dragonroll is a free and open-source tabletop RPG virtual tabletop. It allows you to play your favorite pen-and-paper RPGs online with your friends, with features like character sheets, dice rolling, maps, tokens, and more.' },
|
||||||
|
{ name: 'keywords', content: 'virtual tabletop, vtt, online rpg, pen-and-paper rpg, dungeons and dragons, pathfinder, roll20 alternative' },
|
||||||
|
{ name: 'author', content: 'Aran Roig' },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setupTheme();
|
setupTheme();
|
||||||
setTheme('dark');
|
setTheme('dark');
|
||||||
@@ -21,6 +47,8 @@ onMounted(() => {
|
|||||||
<template>
|
<template>
|
||||||
<div class="viewer">
|
<div class="viewer">
|
||||||
<ToastManager></ToastManager>
|
<ToastManager></ToastManager>
|
||||||
|
<TooltipManager></TooltipManager>
|
||||||
|
<ContextMenuManager></ContextMenuManager>
|
||||||
<WindowManager></WindowManager>
|
<WindowManager></WindowManager>
|
||||||
<ContentManager></ContentManager>
|
<ContentManager></ContentManager>
|
||||||
<!-- Managers -->
|
<!-- Managers -->
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ $themes: (
|
|||||||
background-light: #202020,
|
background-light: #202020,
|
||||||
background-line: #202324,
|
background-line: #202324,
|
||||||
background-fore: #10141f,
|
background-fore: #10141f,
|
||||||
|
background-soft: #20202077,
|
||||||
|
|
||||||
window-handle-background: #191919,
|
window-handle-background: #191919,
|
||||||
window-background: #141414,
|
window-background: #141414,
|
||||||
@@ -16,6 +17,11 @@ $themes: (
|
|||||||
button-hover: #202020aa,
|
button-hover: #202020aa,
|
||||||
button-active: #202020cc,
|
button-active: #202020cc,
|
||||||
|
|
||||||
|
toast-background: #202020,
|
||||||
|
tooltip-background: #2a2a2a,
|
||||||
|
|
||||||
|
note-border: #202324,
|
||||||
|
|
||||||
hover: #21262d,
|
hover: #21262d,
|
||||||
selected: #4a4a4b,
|
selected: #4a4a4b,
|
||||||
border-color: #819796,
|
border-color: #819796,
|
||||||
@@ -24,7 +30,15 @@ $themes: (
|
|||||||
container-shadow: #151d28,
|
container-shadow: #151d28,
|
||||||
sticky-header-bg: #20202077,
|
sticky-header-bg: #20202077,
|
||||||
|
|
||||||
icon-invert: 100%
|
red: #e06c75,
|
||||||
|
green: #98c379,
|
||||||
|
gray: #cccccc,
|
||||||
|
|
||||||
|
icon-invert: 100%,
|
||||||
|
|
||||||
|
search-background: #20202077,
|
||||||
|
search-background-container: #202020ee,
|
||||||
|
search-hover: #2a2a2a,
|
||||||
),
|
),
|
||||||
light: (
|
light: (
|
||||||
background: #ffffff,
|
background: #ffffff,
|
||||||
@@ -41,6 +55,11 @@ $themes: (
|
|||||||
button-hover: #e9e9e9,
|
button-hover: #e9e9e9,
|
||||||
button-active: #d4d4d4,
|
button-active: #d4d4d4,
|
||||||
|
|
||||||
|
toast-background: #f0f0f0,
|
||||||
|
tooltip-background: #f5f5f5,
|
||||||
|
|
||||||
|
note-border: #e0e0e0,
|
||||||
|
|
||||||
border-color: #e0e0e0,
|
border-color: #e0e0e0,
|
||||||
border: #f0f0f0,
|
border: #f0f0f0,
|
||||||
hover: #e9e9e9,
|
hover: #e9e9e9,
|
||||||
@@ -49,7 +68,15 @@ $themes: (
|
|||||||
container-shadow: #5f6774,
|
container-shadow: #5f6774,
|
||||||
sticky-header-bg: #fff,
|
sticky-header-bg: #fff,
|
||||||
|
|
||||||
icon-invert: 0%
|
red: #e06c75,
|
||||||
|
green: #98c379,
|
||||||
|
gray: #cccccc,
|
||||||
|
|
||||||
|
icon-invert: 0%,
|
||||||
|
|
||||||
|
search-background: #f0f0f0aa,
|
||||||
|
search-background-container: #ffffffee,
|
||||||
|
search-hover: #e8e8e8,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,8 @@ textarea {
|
|||||||
background-color: var(--color-background-softer);
|
background-color: var(--color-background-softer);
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
border: none;
|
border-radius: 6px;
|
||||||
|
border: solid 1px var(--color-border);;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus {
|
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus {
|
||||||
@@ -355,3 +356,11 @@ span.artifact {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
color: var(--color-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.green {
|
||||||
|
color: var(--color-green);
|
||||||
|
}
|
||||||
62
frontend/app/components/layouts/ColorPicker.vue
Normal file
62
frontend/app/components/layouts/ColorPicker.vue
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
const color = ref("");
|
||||||
|
const colorValue = ref(null);
|
||||||
|
const colorPicker = ref(null);
|
||||||
|
|
||||||
|
const selectedColorCode = ref(null);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
colorValue.value.addEventListener('click', () => {
|
||||||
|
colorPicker.value.click();
|
||||||
|
})
|
||||||
|
|
||||||
|
colorPicker.value.addEventListener('input', (event) => {
|
||||||
|
let newColor = event.target.value;
|
||||||
|
colorValue.value.classList.remove('unselected');
|
||||||
|
colorValue.value.style.backgroundColor = newColor;
|
||||||
|
color.value = newColor;
|
||||||
|
selectedColorCode.value.textContent = color.value.toUpperCase();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
let GetColor = () => color.value;
|
||||||
|
|
||||||
|
defineExpose({ GetColor });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<input type="color" id="colorPicker" ref="colorPicker">
|
||||||
|
<div class="color-value unselected" ref="colorValue">
|
||||||
|
<span class="selected-color-code" ref="selectedColorCode"></span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
#colorPicker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-value {
|
||||||
|
width: 100px;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
|
&.unselected {
|
||||||
|
background-image: linear-gradient(45deg, #808080 25%, transparent 25%), linear-gradient(-45deg, #808080 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #808080 75%), linear-gradient(-45deg, transparent 75%, #808080 75%);
|
||||||
|
background-size: 10px 10px;
|
||||||
|
background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected-color-code {
|
||||||
|
font-size: 12px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
64
frontend/app/components/layouts/Dropdown.vue
Normal file
64
frontend/app/components/layouts/Dropdown.vue
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, ref, watch } from 'vue';
|
||||||
|
import { AddContextMenu, HideContextMenu } from '@/services/ContextMenu';
|
||||||
|
const props = defineProps(['options', 'onselect', 'selected', 'keyFunc']);
|
||||||
|
const options = props.options;
|
||||||
|
const selectCallback = props.onselect;
|
||||||
|
|
||||||
|
const initialSelect = props.selected;
|
||||||
|
const dropdown = ref(null);
|
||||||
|
const selected = ref(null);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if(props.keyFunc == undefined) props.keyFunc = (option) => option;
|
||||||
|
selected.value = props.keyFunc(initialSelect);
|
||||||
|
|
||||||
|
let context = [];
|
||||||
|
watch(() => props.selected, () => {
|
||||||
|
selected.value = props.keyFunc(props.selected);
|
||||||
|
});
|
||||||
|
options.forEach(obj => {
|
||||||
|
const name = props.keyFunc(obj);
|
||||||
|
context.push({
|
||||||
|
icon: selected.value == name ? 'icons/iconoir/regular/check.svg' : false,
|
||||||
|
name,
|
||||||
|
action: () => {
|
||||||
|
HideContextMenu();
|
||||||
|
selected.value = name;
|
||||||
|
if(selectCallback) selectCallback(obj);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddContextMenu(dropdown.value, context, {dropdown: true});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="dropdown" ref="dropdown">
|
||||||
|
<span>{{ selected }}</span>
|
||||||
|
<img class="icon" src="/icons/iconoir/regular/nav-arrow-down.svg" draggable="false" ref="closeButton">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.dropdown {
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
background-color: var(--color-background-softer);
|
||||||
|
border: none;
|
||||||
|
padding: 4px 8px 4px 8px;
|
||||||
|
margin: 0 6px 0px 6px;
|
||||||
|
border-radius: 6px;
|
||||||
|
color: var(--color-text);
|
||||||
|
transition: 300ms background-color;
|
||||||
|
border: solid 1px var(--color-border);
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
margin-left: auto;
|
||||||
|
justify-content: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
84
frontend/app/components/layouts/IconButton.vue
Normal file
84
frontend/app/components/layouts/IconButton.vue
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<script setup>
|
||||||
|
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
import { AddTooltip } from '~/services/Tooltip';
|
||||||
|
const props = defineProps(['icon', 'action', 'size', 'toggled', 'tooltip']);
|
||||||
|
let icon = props.icon;
|
||||||
|
let action = props.action;
|
||||||
|
|
||||||
|
let size = props.size;
|
||||||
|
let toggled = props.toggled;
|
||||||
|
let tooltip = props.tooltip;
|
||||||
|
|
||||||
|
const button = ref(null);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if(tooltip){
|
||||||
|
AddTooltip(button.value, tooltip);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="icon-button sound-click" :class="size + ' ' + toggled" v-on:click.prevent="action" ref="button">
|
||||||
|
<img class="icon" draggable="false" :src="icon" :class="size">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.icon-button {
|
||||||
|
height: 32px;
|
||||||
|
width: 32px;
|
||||||
|
|
||||||
|
&.big {
|
||||||
|
height: 42px;
|
||||||
|
width: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
height: 24px;
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.toggled {
|
||||||
|
filter: invert(0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
background-color: var(--color-background-soft);
|
||||||
|
border-radius: 6px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin: 2px;
|
||||||
|
|
||||||
|
transition: .3s background-color;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-button:hover {
|
||||||
|
background-color: var(--color-background-softer);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
height: 24px;
|
||||||
|
width: 24px;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
|
&.big {
|
||||||
|
height: 38px;
|
||||||
|
width: 38px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
height: 18px;
|
||||||
|
width: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
101
frontend/app/components/layouts/Tabs.vue
Normal file
101
frontend/app/components/layouts/Tabs.vue
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
const props = defineProps(['rows']);
|
||||||
|
|
||||||
|
const rowDict = {}
|
||||||
|
for(let i = 0; i < props.rows.length; i++) rowDict[props.rows[i].id] = i;
|
||||||
|
let selectedTab = ref(props.rows[0].id);
|
||||||
|
|
||||||
|
function SelectTab(row){
|
||||||
|
selectedTab.value = row;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="tab-container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="toggler" :class="{ selected: row.id == selectedTab }" v-for="row in rows" v-on:click.prevent="SelectTab(row.id)">
|
||||||
|
{{ $t(row.value) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tab-container-outer">
|
||||||
|
<div v-for="row in rows" class="tab-content">
|
||||||
|
<TransitionGroup name="tab">
|
||||||
|
<div class="tab-content-inner" v-show="row.id == selectedTab" :key="row.id">
|
||||||
|
<slot :name="row.id" />
|
||||||
|
</div>
|
||||||
|
</TransitionGroup>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.toggler.selected {
|
||||||
|
color: var(--color-text);
|
||||||
|
background-color: var(--color-background-softer);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.tab-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-container-outer {
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-enter-active,
|
||||||
|
.tab-leave-active {
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
}
|
||||||
|
.tab-enter-from,
|
||||||
|
.tab-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(15px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-content {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-content-inner {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggler {
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-basis: 0;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 3px 12px 3px 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
|
color: #9c9c9c;
|
||||||
|
border-left: 1px solid var(--color-border);
|
||||||
|
border-bottom: 1px solid var(--color-border);
|
||||||
|
border-top: 1px solid var(--color-border);
|
||||||
|
transition: color 0.2s, background-color 0.2s;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
color: var(--color-text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,18 +1,41 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import { watch } from 'vue';
|
||||||
import Content from '../viewer/content/Content.vue';
|
import Content from '../viewer/content/Content.vue';
|
||||||
import StatusBar from '../viewer/statusbar/StatusBar.vue';
|
import StatusBar from '../viewer/statusbar/StatusBar.vue';
|
||||||
import TopBar from '../viewer/TopBar.vue';
|
import TopBar from '../viewer/TopBar.vue';
|
||||||
|
|
||||||
import { ShowContent } from '../../services/Content.js';
|
import { ShowContent } from '../../services/Content.js';
|
||||||
|
import { useCampaignService } from '~/services/Campaign.js';
|
||||||
|
import ContentSidebar from '../partials/ContentSidebar.vue';
|
||||||
|
|
||||||
|
const { Campaign } = useCampaignService();
|
||||||
|
|
||||||
|
watch(Campaign, () => {
|
||||||
|
if(Campaign.value) ShowContent.value = true;
|
||||||
|
}, { immediate: true });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-show="ShowContent">
|
<div v-show="ShowContent" class="content-manager">
|
||||||
<TopBar></TopBar>
|
<TopBar></TopBar>
|
||||||
|
<div class="content-layout">
|
||||||
|
<ContentSidebar></ContentSidebar>
|
||||||
<Content></Content>
|
<Content></Content>
|
||||||
|
</div>
|
||||||
<StatusBar></StatusBar>
|
<StatusBar></StatusBar>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.content-manager {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-layout {
|
||||||
|
min-height: 0;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
89
frontend/app/components/managers/ContextMenuManager.vue
Normal file
89
frontend/app/components/managers/ContextMenuManager.vue
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, watch, ref } from 'vue';
|
||||||
|
import { SetupContextMenu } from '../../services/ContextMenu';
|
||||||
|
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
SetupContextMenu();
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div id="context-menu" class="context-menu">
|
||||||
|
<!--
|
||||||
|
<div class="context-menu-element">
|
||||||
|
<span>Hola</span> <img src="/icons/iconoir/regular/nav-arrow-right.svg">
|
||||||
|
</div>
|
||||||
|
<div class="context-menu-element">
|
||||||
|
<span>Holaa</span>
|
||||||
|
</div>
|
||||||
|
<div class="context-menu-element">
|
||||||
|
<span>Holaa</span>
|
||||||
|
</div>
|
||||||
|
<div class="context-menu-element">
|
||||||
|
<span>Holaaaaaaa</span>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.context-menu {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 214748363;
|
||||||
|
|
||||||
|
flex-direction: column;
|
||||||
|
background-color: var(--color-tooltip-background);
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
overflow: visible;
|
||||||
|
|
||||||
|
.context-menu-divider {
|
||||||
|
height: 1px;
|
||||||
|
margin: 4px 0;
|
||||||
|
border-top: 1px solid var(--color-border);
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.context-menu-element {
|
||||||
|
&:last-child {
|
||||||
|
border-width: 1px 1px 1px 1px;
|
||||||
|
}
|
||||||
|
border: solid 1px var(--color-border);
|
||||||
|
border-width: 1px 1px 0px 1px;
|
||||||
|
padding: 6px 10px 6px 8px;
|
||||||
|
cursor: default;
|
||||||
|
user-select: none;
|
||||||
|
background-color: var(--color-tooltip-background);
|
||||||
|
transition: background-color 100ms;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
span {
|
||||||
|
flex-grow: 1;
|
||||||
|
padding-right: 24px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
filter: invert(1);
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--color-background-softest);
|
||||||
|
}
|
||||||
|
|
||||||
|
> .context-menu {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover > .context-menu {
|
||||||
|
display: flex !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -51,12 +51,12 @@ emitter.on('toast', data => {
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.toast-container {
|
.toast-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: var(--color-background-soft);
|
background-color: var(--color-toast-background);
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
border-top-right-radius: 6px;
|
border-top-right-radius: 6px;
|
||||||
border-bottom-right-radius: 6px;
|
border-bottom-right-radius: 6px;
|
||||||
transform: translate(2px,0px)
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toast {
|
.toast {
|
||||||
@@ -72,6 +72,7 @@ emitter.on('toast', data => {
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
flex-direction: column;
|
||||||
z-index: 9999999;
|
z-index: 9999999;
|
||||||
|
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ emitter.on('toast', data => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.show {
|
&.show {
|
||||||
display: block;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Colors!!!! */
|
/* Colors!!!! */
|
||||||
|
|||||||
41
frontend/app/components/managers/TooltipManager.vue
Normal file
41
frontend/app/components/managers/TooltipManager.vue
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, watch, ref } from 'vue';
|
||||||
|
import { GetContentRef, SetupTooltip } from '../../services/Tooltip';
|
||||||
|
|
||||||
|
let contentRef = ref("");
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
SetupTooltip();
|
||||||
|
let content = GetContentRef();
|
||||||
|
|
||||||
|
watch(GetContentRef(), () => {
|
||||||
|
contentRef.value = GetContentRef().value;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div id="mouse-tooltip" class="mouse-tooltip">
|
||||||
|
<div class="document">
|
||||||
|
<span v-html="contentRef"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.mouse-tooltip {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 214748364;
|
||||||
|
|
||||||
|
background-color: var(--tooltip-background);
|
||||||
|
padding: 3px 6px 3px 6px;
|
||||||
|
|
||||||
|
-webkit-box-shadow: 0px 0px 5px -2px rgba(0,0,0,0.75);
|
||||||
|
-moz-box-shadow: 0px 0px 5px -2px rgba(0,0,0,0.75);
|
||||||
|
box-shadow: 0px 0px 5px -2px rgba(0,0,0,0.75);
|
||||||
|
|
||||||
|
border: solid 1px var(--color-border);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,19 +1,12 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { TransitionGroup } from 'vue'
|
import { TransitionGroup } from 'vue'
|
||||||
import { Windows, ReloadRef, WindowMap, getComponent } from '@/services/Windows';
|
import { windows, getComponent } from '@/services/Windows';
|
||||||
|
|
||||||
// Gestionem ventanas
|
|
||||||
const reload = ReloadRef();
|
|
||||||
const windows = Windows();
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="window-container" :key="reload">
|
<TransitionGroup name="window" tag="div">
|
||||||
<TransitionGroup name="window">
|
<component v-for="win in windows" :key="win.id" :is="getComponent(win.type)" :data="win" />
|
||||||
<component v-for="win in windows" :is="getComponent(win.type)" :key="win.id" :data="win"></component>
|
|
||||||
</TransitionGroup>
|
</TransitionGroup>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
@@ -24,16 +17,18 @@ const windows = Windows();
|
|||||||
}
|
}
|
||||||
.window-enter-from,
|
.window-enter-from,
|
||||||
.window-leave-to {
|
.window-leave-to {
|
||||||
|
transition: all 0.15s ease;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(15px);
|
transform: translateY(15px);
|
||||||
}
|
}
|
||||||
|
.window-move {
|
||||||
|
transition: transform 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
.window-wrapper {
|
.window-wrapper {
|
||||||
background-color: var(--color-window-background);
|
background-color: var(--color-window-background);
|
||||||
|
|
||||||
/* backdrop-filter: blur(10px); */
|
/* backdrop-filter: blur(10px); */
|
||||||
position: fixed;
|
|
||||||
|
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
85
frontend/app/components/partials/CampaignEntry.vue
Normal file
85
frontend/app/components/partials/CampaignEntry.vue
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<script setup>
|
||||||
|
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
import { AddSound } from '../../services/Sound';
|
||||||
|
import { useCampaignService } from '~/services/Campaign';
|
||||||
|
import { ClearWindow } from '~/services/Windows';
|
||||||
|
const { SetCampaign } = useCampaignService();
|
||||||
|
|
||||||
|
const props = defineProps(['data']);
|
||||||
|
const data = props.data;
|
||||||
|
|
||||||
|
const title = ref("");
|
||||||
|
|
||||||
|
const container = ref(null);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
title.value = data.name;
|
||||||
|
if (data.color && container.value) {
|
||||||
|
container.value.style.background = `linear-gradient(90deg, ${data.color}, ${data.color}44)`;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddSound(container.value)
|
||||||
|
});
|
||||||
|
|
||||||
|
function ViewCampaign(){
|
||||||
|
SetCampaign(data);
|
||||||
|
ClearWindow({type: "main_menu"});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="campaign-entry-container" ref="container">
|
||||||
|
<div class="main-campaign-entry-container-inner">
|
||||||
|
<img class="campaign-icon" src="/img/def-avatar.jpg" draggable="false">
|
||||||
|
<div class="campaign-info">
|
||||||
|
<b>{{ title }}</b>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="campaign-user-actions">
|
||||||
|
<button class="btn-primary button-small sound-click" v-on:click.prevent="ViewCampaign">{{ $t('general.open')}}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.button-small {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.campaign-entry-container {
|
||||||
|
background-color: var(--color-background-softer);
|
||||||
|
width: 100%;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
|
border-bottom: 1px solid var(--color-border);
|
||||||
|
&:first-child {
|
||||||
|
border-top: 1px solid var(--color-border);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-campaign-entry-container-inner {
|
||||||
|
padding: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.campaign-info {
|
||||||
|
text-align: left;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.campaign-icon {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.campaign-user-actions {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
389
frontend/app/components/partials/ContentSidebar.vue
Normal file
389
frontend/app/components/partials/ContentSidebar.vue
Normal file
@@ -0,0 +1,389 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
|
import { useCampaignService } from '~/services/Campaign.js';
|
||||||
|
import { emitter } from '~/services/Emitter';
|
||||||
|
import Server from '~/services/Server';
|
||||||
|
import { CreateWindow } from '~/services/Windows';
|
||||||
|
import NestedNoteList from './NestedNoteList.vue';
|
||||||
|
|
||||||
|
const { Campaign } = useCampaignService();
|
||||||
|
const notes = ref([]);
|
||||||
|
const folders = ref([]);
|
||||||
|
const loadingNotes = ref(false);
|
||||||
|
const notesError = ref('');
|
||||||
|
const sidebarCollapsed = ref(false);
|
||||||
|
const isDragOverSidebar = ref(false);
|
||||||
|
const expandedFolderIds = ref([]);
|
||||||
|
const nestedNoteListRef = ref(null);
|
||||||
|
|
||||||
|
async function handleSidebarDrop(event) {
|
||||||
|
const noteKey = event.dataTransfer.getData('text/plain');
|
||||||
|
if (!noteKey) return;
|
||||||
|
try {
|
||||||
|
await Server().post('/note/update', { id: noteKey, folder: null });
|
||||||
|
fetchCampaignNotes();
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleExpandedFolder(folderId) {
|
||||||
|
const arr = expandedFolderIds.value;
|
||||||
|
const idx = arr.indexOf(folderId);
|
||||||
|
if (idx !== -1) {
|
||||||
|
arr.splice(idx, 1);
|
||||||
|
} else {
|
||||||
|
arr.push(folderId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isFolderExpanded(folderId) {
|
||||||
|
return expandedFolderIds.value.includes(folderId);
|
||||||
|
}
|
||||||
|
|
||||||
|
function openNote(note) {
|
||||||
|
emitter.emit('push-note', note);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleNoteCreated(note) {
|
||||||
|
if (!note) return;
|
||||||
|
|
||||||
|
const noteCampaignId = note.campaign?._id ?? note.campaign ?? null;
|
||||||
|
if (campaignId.value && noteCampaignId && noteCampaignId !== campaignId.value) return;
|
||||||
|
|
||||||
|
const createdNote = {
|
||||||
|
key: note._id,
|
||||||
|
title: note.title,
|
||||||
|
text: note.content ?? '',
|
||||||
|
date: note.date
|
||||||
|
};
|
||||||
|
|
||||||
|
notes.value = notes.value.filter((currentNote) => currentNote.key !== createdNote.key);
|
||||||
|
notes.value.unshift(createdNote);
|
||||||
|
openNote(createdNote);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleNoteRenamed(data) {
|
||||||
|
const note = notes.value.find(n => n.key === data.key);
|
||||||
|
if (note) {
|
||||||
|
note.title = data.title;
|
||||||
|
}
|
||||||
|
emitter.emit('title-updated', { key: data.key, title: data.title });
|
||||||
|
}
|
||||||
|
|
||||||
|
const campaignId = computed(() => {
|
||||||
|
return Campaign.value?._id ?? Campaign.value?.id ?? null;
|
||||||
|
});
|
||||||
|
|
||||||
|
async function fetchCampaignNotes() {
|
||||||
|
if (!campaignId.value) {
|
||||||
|
notes.value = [];
|
||||||
|
folders.value = [];
|
||||||
|
notesError.value = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadingNotes.value = true;
|
||||||
|
notesError.value = '';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await Server().get('/note/list', { params: { campaign: campaignId.value } });
|
||||||
|
|
||||||
|
if (response.data.status !== 'ok') {
|
||||||
|
notes.value = [];
|
||||||
|
folders.value = [];
|
||||||
|
notesError.value = response.data.msg ?? 'Unable to load notes.';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
folders.value = response.data.folders.map((folder) => ({
|
||||||
|
_id: folder._id, name: folder.name, date: folder.date
|
||||||
|
}));
|
||||||
|
|
||||||
|
notes.value = response.data.notes.map((note) => {
|
||||||
|
return { key: note._id, title: note.title, text: note.content ?? '', date: note.date };
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
notes.value = [];
|
||||||
|
folders.value = [];
|
||||||
|
notesError.value = 'Unable to load notes.';
|
||||||
|
} finally {
|
||||||
|
loadingNotes.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createNote() {
|
||||||
|
if (!Campaign.value) return;
|
||||||
|
|
||||||
|
const cid = Campaign.value?._id;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await Server().post('/note/create', {
|
||||||
|
title: 'New note',
|
||||||
|
content: '',
|
||||||
|
campaign: cid
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.data.status !== 'ok') return;
|
||||||
|
|
||||||
|
emitter.emit('note-created', response.data.note);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createFolder() {
|
||||||
|
CreateWindow('new_folder', { campaign: campaignId.value });
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleSidebar() {
|
||||||
|
sidebarCollapsed.value = !sidebarCollapsed.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rootNotes = computed(() => notes.value.filter(n => !n._folder));
|
||||||
|
|
||||||
|
watch(campaignId, (newVal) => {
|
||||||
|
if (newVal) {
|
||||||
|
fetchCampaignNotes();
|
||||||
|
} else {
|
||||||
|
notes.value = [];
|
||||||
|
folders.value = [];
|
||||||
|
notesError.value = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (campaignId.value) {
|
||||||
|
fetchCampaignNotes();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="sidebar-shell">
|
||||||
|
<nav class="sidebar-actions" aria-label="Campaign tools">
|
||||||
|
<button
|
||||||
|
class="sidebar-action"
|
||||||
|
type="button"
|
||||||
|
@click="toggleSidebar"
|
||||||
|
:aria-expanded="(!sidebarCollapsed).toString()"
|
||||||
|
aria-controls="campaign-notes-list"
|
||||||
|
:title="sidebarCollapsed ? 'Expand notes' : 'Collapse notes'"
|
||||||
|
:aria-label="sidebarCollapsed ? 'Expand notes' : 'Collapse notes'"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
class="sidebar-action-icon"
|
||||||
|
:src="sidebarCollapsed ? '/icons/iconoir/regular/nav-arrow-right.svg' : '/icons/iconoir/regular/nav-arrow-left.svg'"
|
||||||
|
alt=""
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="sidebar-action"
|
||||||
|
type="button"
|
||||||
|
@click="createNote"
|
||||||
|
:disabled="!Campaign"
|
||||||
|
title="New note"
|
||||||
|
aria-label="New note"
|
||||||
|
>
|
||||||
|
<img class="sidebar-action-icon" src="/icons/iconoir/regular/plus.svg" alt="" aria-hidden="true">
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="sidebar-action"
|
||||||
|
type="button"
|
||||||
|
@click="createFolder"
|
||||||
|
:disabled="!Campaign"
|
||||||
|
title="New folder"
|
||||||
|
aria-label="New folder"
|
||||||
|
>
|
||||||
|
<img class="sidebar-action-icon" src="/icons/iconoir/regular/folder.svg" alt="" aria-hidden="true">
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="sidebar-action"
|
||||||
|
type="button"
|
||||||
|
@click="fetchCampaignNotes"
|
||||||
|
:disabled="!Campaign || loadingNotes"
|
||||||
|
title="Refresh notes"
|
||||||
|
aria-label="Refresh notes"
|
||||||
|
>
|
||||||
|
<img class="sidebar-action-icon" src="/icons/iconoir/regular/refresh.svg" alt="" aria-hidden="true">
|
||||||
|
</button>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<aside class="notes-sidebar" :class="{ collapsed: sidebarCollapsed }">
|
||||||
|
<div class="sidebar-header">
|
||||||
|
<div class="sidebar-copy">
|
||||||
|
<span class="sidebar-eyebrow">Campaign</span>
|
||||||
|
<strong class="sidebar-title">Notes</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sidebar-list-drop-wrap" :class="{ 'drag-over': isDragOverSidebar }" id="campaign-notes-list" @dragenter.self="isDragOverSidebar = true" @dragleave.self="isDragOverSidebar = false" @dragover.prevent @drop.stop="handleSidebarDrop">
|
||||||
|
<div v-if="loadingNotes" class="sidebar-state">
|
||||||
|
Loading notes...
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="notesError" class="sidebar-state error">
|
||||||
|
{{ notesError }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="folders.length === 0 && notes.length === 0" class="sidebar-state">
|
||||||
|
No notes in this campaign yet.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<NestedNoteList ref="nestedNoteListRef"
|
||||||
|
:parent-folder-id="null"
|
||||||
|
:folders="folders"
|
||||||
|
:notes="rootNotes"
|
||||||
|
:campaign-id="campaignId"
|
||||||
|
:expanded-folder-ids="expandedFolderIds"
|
||||||
|
@open-note="openNote"
|
||||||
|
@reload-notes="fetchCampaignNotes"
|
||||||
|
@toggle-expanded-folder="toggleExpandedFolder"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.sidebar-shell {
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-actions {
|
||||||
|
width: 32px;
|
||||||
|
min-width: 32px;
|
||||||
|
padding: 8px 6px;
|
||||||
|
border-right: 1px solid var(--color-border);
|
||||||
|
background-color: var(--color-background-light);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-action {
|
||||||
|
width: 34px;
|
||||||
|
height: 34px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--color-background-soft);
|
||||||
|
box-shadow: none;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-action:hover {
|
||||||
|
background: var(--color-button-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-action:disabled {
|
||||||
|
opacity: 0.45;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-action-icon {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
filter: invert(var(--color-icon-invert));
|
||||||
|
}
|
||||||
|
|
||||||
|
.notes-sidebar {
|
||||||
|
min-width: 280px;
|
||||||
|
width: 280px;
|
||||||
|
border-right: 1px solid var(--color-border);
|
||||||
|
background-color: var(--color-background-light);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: width 0.2s ease, min-width 0.2s ease, border-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notes-sidebar.collapsed {
|
||||||
|
width: 0;
|
||||||
|
min-width: 0;
|
||||||
|
border-right-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-header {
|
||||||
|
width: 280px;
|
||||||
|
min-width: 280px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 10px;
|
||||||
|
border-bottom: 1px solid var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-copy {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-eyebrow,
|
||||||
|
.sidebar-meta {
|
||||||
|
font-size: 12px;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-title {
|
||||||
|
line-height: 1.2;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-list-drop-wrap {
|
||||||
|
width: 280px;
|
||||||
|
min-width: 280px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 10px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow-y: auto;
|
||||||
|
gap: 2px;
|
||||||
|
transition: background-color 0.15s ease;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-list-drop-wrap.drag-over {
|
||||||
|
background: var(--color-button-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-state {
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: var(--color-background-soft);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-state.error {
|
||||||
|
color: #9e2a2b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.notes-sidebar {
|
||||||
|
width: 220px;
|
||||||
|
min-width: 220px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-header,
|
||||||
|
.sidebar-list-drop-wrap {
|
||||||
|
width: 220px;
|
||||||
|
min-width: 220px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
152
frontend/app/components/partials/EditUserPartial.vue
Normal file
152
frontend/app/components/partials/EditUserPartial.vue
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
import { GetUser, LogoutUser } from '@/services/User'
|
||||||
|
|
||||||
|
import Server, { getBaseUrl } from '@/services/Server'
|
||||||
|
|
||||||
|
import { CreateWindow, CreateChildWindow, ClearWindow, GetFirstWindowId } from '../../services/Windows';
|
||||||
|
import Spinner from './Spinner.vue';
|
||||||
|
const loadedIcon = ref(false);
|
||||||
|
|
||||||
|
const username = ref("");
|
||||||
|
username.value = GetUser().username;
|
||||||
|
|
||||||
|
function retrieveAvatar(){
|
||||||
|
let userAvatarDisplay = document.getElementById("upload-image");
|
||||||
|
|
||||||
|
// Hide image + show spinner while loading
|
||||||
|
loadedIcon.value = false;
|
||||||
|
|
||||||
|
Server().get('/user/retrieve-avatar?username=' + GetUser().username)
|
||||||
|
.then((response) => {
|
||||||
|
if(response.data.image){
|
||||||
|
const imgUrl = getBaseUrl() + "/public/" + response.data.image;
|
||||||
|
|
||||||
|
// Wait for the image to fully load
|
||||||
|
const img = new Image();
|
||||||
|
img.src = imgUrl;
|
||||||
|
|
||||||
|
img.onload = () => {
|
||||||
|
userAvatarDisplay.src = imgUrl;
|
||||||
|
loadedIcon.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
img.onerror = () => {
|
||||||
|
console.log("Image failed to load");
|
||||||
|
loadedIcon.value = true; // fallback to avoid infinite spinner
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => console.log("Internal error"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function LogOut(){
|
||||||
|
LogoutUser();
|
||||||
|
|
||||||
|
ClearWindow({type: "main_menu"});
|
||||||
|
CreateWindow('login');
|
||||||
|
}
|
||||||
|
|
||||||
|
function EditSettings(){
|
||||||
|
CreateChildWindow(GetFirstWindowId('main_menu'), 'settings', {
|
||||||
|
user: GetUser()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
let userAvatarDisplay = document.getElementById("upload-image");
|
||||||
|
let sendAvatarFileUploader = document.getElementById("send-avatar-file-uploader");
|
||||||
|
|
||||||
|
sendAvatarFileUploader.addEventListener("change", (event) => {
|
||||||
|
const formData = new FormData();
|
||||||
|
const image = event.target.files[0];
|
||||||
|
|
||||||
|
formData.append("image", image);
|
||||||
|
|
||||||
|
Server().post('/user/upload-avatar', formData, {
|
||||||
|
headers: { "Content-Type": "multipart/form-data" }
|
||||||
|
}).then((response) => {
|
||||||
|
retrieveAvatar();
|
||||||
|
}).catch((err) => console.log("Internal error"));
|
||||||
|
});
|
||||||
|
|
||||||
|
userAvatarDisplay.addEventListener("click", (event) => {
|
||||||
|
sendAvatarFileUploader.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
retrieveAvatar();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<form id="send-avatar-form" enctype="multipart/form-data">
|
||||||
|
<input name="file" type="file" accept="image/*" id="send-avatar-file-uploader">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="main-user-container">
|
||||||
|
<div class="main-user-container-inner">
|
||||||
|
<div class="user-icon-container">
|
||||||
|
<img class="user-icon" src="/img/def-avatar.jpg" id="upload-image" draggable="false" v-show="loadedIcon">
|
||||||
|
<Spinner v-show="!loadedIcon" :size="30"></Spinner>
|
||||||
|
</div>
|
||||||
|
<div class="main-user-info">
|
||||||
|
<b>{{ username }}</b><br>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="main-user-actions">
|
||||||
|
<button class="btn-primary button-small sound-click" v-on:click.prevent="EditSettings">{{ $t("main-menu.settings") }}</button>
|
||||||
|
<button class="btn-primary button-small sound-click" v-on:click.prevent="LogOut">{{ $t("main-menu.log-out") }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
#send-avatar-form {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-small {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-user-container {
|
||||||
|
background-color: var(--color-background-softer);
|
||||||
|
width: 100%;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-user-container-inner {
|
||||||
|
padding: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-user-info {
|
||||||
|
text-align: left;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-icon {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-icon-container {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-user-actions {
|
||||||
|
margin-left: auto;
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
300
frontend/app/components/partials/NestedNoteList.vue
Normal file
300
frontend/app/components/partials/NestedNoteList.vue
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, onMounted, watch } from 'vue';
|
||||||
|
import { emitter } from '~/services/Emitter';
|
||||||
|
import Server from '~/services/Server';
|
||||||
|
import { CreateWindow } from '~/services/Windows';
|
||||||
|
import { ShowContextMenu, HideContextMenu } from '~/services/ContextMenu';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
folders: Array,
|
||||||
|
notes: Array,
|
||||||
|
campaignId: String,
|
||||||
|
level: { type: Number, default: 0 },
|
||||||
|
parentFolderId: String,
|
||||||
|
expandedFolderIds: { type: Array, default: () => [] }
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['open-note', 'reload-notes']);
|
||||||
|
|
||||||
|
// Track which folder IDs have been requested to avoid duplicate requests
|
||||||
|
const loadingFolders = new Set();
|
||||||
|
const dragHoveredFolderId = ref(null);
|
||||||
|
|
||||||
|
// Cache of loaded folder contents — persists across reloads until cleared
|
||||||
|
// Each entry: { [folderId]: { notes: [], subfolders: [] } }
|
||||||
|
const folderContentCache = ref({});
|
||||||
|
|
||||||
|
function toggleExpanded(folderId) {
|
||||||
|
emit('toggle-expanded-folder', folderId);
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.expandedFolderIds,
|
||||||
|
() => {
|
||||||
|
if (props.level === 0) {
|
||||||
|
loadExpandedFolders();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadExpandedFolders();
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadFolderContents(folderId) {
|
||||||
|
if (loadingFolders.has(folderId)) return;
|
||||||
|
loadingFolders.add(folderId);
|
||||||
|
|
||||||
|
Server().get('/note/subfolder/list', { params: { campaign: props.campaignId, folder: folderId } })
|
||||||
|
.then(res => {
|
||||||
|
if (res.data.status !== 'ok') return;
|
||||||
|
folderContentCache.value[folderId] = {
|
||||||
|
notes: res.data.notes.map(n => ({ key: n._id, title: n.title, text: n.content || '' })),
|
||||||
|
subfolders: res.data.subfolders || []
|
||||||
|
};
|
||||||
|
}).catch(() => {}).finally(() => {
|
||||||
|
loadingFolders.delete(folderId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFolderNotes(folderId) {
|
||||||
|
return folderContentCache.value[folderId]?.notes || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFolderSubfolders(folderId) {
|
||||||
|
return folderContentCache.value[folderId]?.subfolders || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load contents for all currently-expanded folders
|
||||||
|
function loadExpandedFolders() {
|
||||||
|
const idsToLoad = props.level === 0
|
||||||
|
? props.expandedFolderIds
|
||||||
|
: (props.parentFolderId && props.expandedFolderIds.includes(props.parentFolderId) ? [props.parentFolderId] : []);
|
||||||
|
|
||||||
|
for (const id of idsToLoad) {
|
||||||
|
if (folderContentCache.value[id]) continue;
|
||||||
|
loadFolderContents(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDropNoteOnFolder(folderId, event) {
|
||||||
|
const noteKey = event.dataTransfer.getData('text/plain');
|
||||||
|
if (!noteKey || !folderId) return;
|
||||||
|
|
||||||
|
dragHoveredFolderId.value = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await Server().post('/note/update', { id: noteKey, folder: folderId });
|
||||||
|
emit('reload-notes');
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDropNoteOnRoot(event) {
|
||||||
|
const noteKey = event.dataTransfer.getData('text/plain');
|
||||||
|
if (!noteKey) return;
|
||||||
|
|
||||||
|
dragHoveredFolderId.value = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await Server().post('/note/update', { id: noteKey, folder: null });
|
||||||
|
emit('reload-notes');
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called on reload — clears cache so expanded folders refetch fresh content
|
||||||
|
function clearCacheAndReloadExpanded() {
|
||||||
|
const folderIdsToReLoad = [];
|
||||||
|
if (props.level === 0) {
|
||||||
|
for (const id of props.expandedFolderIds) {
|
||||||
|
if (folderContentCache.value[id]) folderIdsToReLoad.push(id);
|
||||||
|
delete folderContentCache.value[id];
|
||||||
|
}
|
||||||
|
} else if (props.parentFolderId && folderContentCache.value[props.parentFolderId]) {
|
||||||
|
folderIdsToReLoad.push(props.parentFolderId);
|
||||||
|
delete folderContentCache.value[props.parentFolderId];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force reactivity by creating a new object
|
||||||
|
folderContentCache.value = {};
|
||||||
|
|
||||||
|
for (const id of folderIdsToReLoad) {
|
||||||
|
loadFolderContents(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exposed to parent components
|
||||||
|
defineExpose({ clearCacheAndReloadExpanded });
|
||||||
|
|
||||||
|
function startDragNote(event, note) {
|
||||||
|
event.dataTransfer.setData('text/plain', note.key);
|
||||||
|
event.dataTransfer.effectAllowed = 'move';
|
||||||
|
}
|
||||||
|
|
||||||
|
function setDragHover(id) {
|
||||||
|
dragHoveredFolderId.value = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearDragHover() {
|
||||||
|
dragHoveredFolderId.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildNoteContextMenu(note) {
|
||||||
|
return [
|
||||||
|
{ name: 'Open', icon: '/icons/iconoir/regular/book.svg', action: () => emit('open-note', note) },
|
||||||
|
{ name: 'Rename', icon: '/icons/iconoir/regular/edit-pencil.svg', action: () => renameNote(note) },
|
||||||
|
{
|
||||||
|
name: 'Move to Folder...', icon: '/icons/iconoir/regular/folder.svg',
|
||||||
|
context: buildMoveToMenu(note)
|
||||||
|
},
|
||||||
|
{ divider: true },
|
||||||
|
{ name: 'Delete', icon: '/icons/iconoir/regular/trash.svg', action: () => deleteNote(note) }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildFolderContextMenu(folder) {
|
||||||
|
if (!folder || !folder._id) return [];
|
||||||
|
return [
|
||||||
|
{ name: 'New Note Here', icon: '/icons/iconoir/regular/plus.svg', action: () => createNoteInFolder(folder._id) },
|
||||||
|
{ name: 'Rename', icon: '/icons/iconoir/regular/edit-pencil.svg', action: () => renameFolder(folder._id, folder.name) },
|
||||||
|
{ name: 'Delete Folder', icon: '/icons/iconoir/regular/trash.svg', action: () => deleteFolder(folder._id) }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
let selectedNoteForMove = {};
|
||||||
|
|
||||||
|
function buildMoveToMenu(note) {
|
||||||
|
selectedNoteForMove = note;
|
||||||
|
const moveItems = (props.folders || []).map(folder => ({
|
||||||
|
name: folder.name, icon: '/icons/iconoir/regular/folder.svg', action: () => moveNoteToFolder(note, folder._id)
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (moveItems.length > 0) moveItems.push({ divider: true });
|
||||||
|
|
||||||
|
moveItems.push({ name: '(Root)', icon: '/icons/iconoir/regular/book.svg', action: () => moveNoteToFolder(note, null) });
|
||||||
|
return moveItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renameNote(note) { CreateWindow('rename_note', { title: note.title, key: note.key }); }
|
||||||
|
|
||||||
|
async function deleteNote(note) {
|
||||||
|
try {
|
||||||
|
const response = await Server().post('/note/delete', { id: note.key });
|
||||||
|
if (response.data.status === 'ok') { emit('reload-notes'); emitter.emit('delete-note', note.key); }
|
||||||
|
} catch (error) {} finally {
|
||||||
|
HideContextMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renameFolder(folderId, name) { CreateWindow('new_folder', { folderId, campaign: props.campaignId, name }); }
|
||||||
|
|
||||||
|
async function deleteFolder(folderId) {
|
||||||
|
const response = await Server().post('/folder/delete', { id: folderId });
|
||||||
|
if (response.data.status === 'ok') emit('reload-notes');
|
||||||
|
HideContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function moveNoteToFolder(note, folderId) {
|
||||||
|
try {
|
||||||
|
const response = await Server().post('/note/update', { id: note.key, folder: folderId || null });
|
||||||
|
if (response.data.status !== 'ok') return;
|
||||||
|
emit('reload-notes');
|
||||||
|
} catch (e) {}
|
||||||
|
HideContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createNoteInFolder(folderId) {
|
||||||
|
try {
|
||||||
|
const response = await Server().post('/note/create', { title: 'New note', content: '', campaign: props.campaignId, folder: folderId });
|
||||||
|
if (response.data.status === 'ok') emit('reload-notes');
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="nested-list" :class="'level-' + level">
|
||||||
|
<!-- Folders at this level -->
|
||||||
|
<template v-for="folder in folders" :key="folder._id">
|
||||||
|
<div class="folder-item" :class="{ 'drag-over': dragHoveredFolderId === folder._id }"
|
||||||
|
@dragover.prevent="setDragHover(folder._id)"
|
||||||
|
@dragleave.self="clearDragHover"
|
||||||
|
@drop.stop="handleDropNoteOnFolder(folder._id, $event)">
|
||||||
|
<button type="button" class="folder-toggle" @click="toggleExpanded(folder._id)" @contextmenu.prevent="ShowContextMenu(buildFolderContextMenu(folder))">
|
||||||
|
<img
|
||||||
|
class="folder-arrow"
|
||||||
|
:src="expandedFolderIds.includes(folder._id) ? '/icons/iconoir/regular/nav-arrow-down.svg' : '/icons/iconoir/regular/nav-arrow-right.svg'"
|
||||||
|
alt="" aria-hidden="true"
|
||||||
|
>
|
||||||
|
<img class="folder-icon" src="/icons/iconoir/regular/folder.svg" alt="">
|
||||||
|
<span class="folder-name">{{ folder.name }}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div v-show="expandedFolderIds.includes(folder._id)"
|
||||||
|
class="folder-children" :class="{ 'drag-over': dragHoveredFolderId === folder._id }"
|
||||||
|
@dragover.prevent="setDragHover(folder._id)" @dragleave.self="clearDragHover"
|
||||||
|
@drop.stop="handleDropNoteOnFolder(folder._id, $event)">
|
||||||
|
|
||||||
|
<!-- Load contents now — cache will be populated on demand -->
|
||||||
|
<template v-if="expandedFolderIds.includes(folder._id) && !folderContentCache[folder._id]">
|
||||||
|
<div class="sidebar-state" style="font-size:13px;opacity:0.6;">Loading...</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<NestedNoteList
|
||||||
|
v-if="expandedFolderIds.includes(folder._id)"
|
||||||
|
:folders="getFolderSubfolders(folder._id)"
|
||||||
|
:notes="getFolderNotes(folder._id)"
|
||||||
|
:campaign-id="campaignId"
|
||||||
|
:level="level + 1"
|
||||||
|
:parent-folder-id="folder._id"
|
||||||
|
:expanded-folder-ids="expandedFolderIds"
|
||||||
|
@open-note="$emit('open-note', $event)"
|
||||||
|
@reload-notes="clearCacheAndReloadExpanded"
|
||||||
|
@toggle-expanded-folder="toggleExpanded"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div v-if="expandedFolderIds.includes(folder._id) && folderContentCache[folder._id] !== undefined && (getFolderNotes(folder._id).length === 0 && getFolderSubfolders(folder._id).length === 0)" class="sidebar-state">
|
||||||
|
Empty folder
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Notes at this level -->
|
||||||
|
<template v-for="note in notes" :key="note.key">
|
||||||
|
<button type="button" class="note-link" draggable="true" @dragstart="startDragNote($event, note)" @click.stop="$emit('open-note', note)" @contextmenu.prevent="ShowContextMenu(buildNoteContextMenu(note))">
|
||||||
|
<span class="note-link-title">{{ note.title }}</span>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Drop zone for root-level notes -->
|
||||||
|
<div v-if="level === 0" class="root-drop-zone" :class="{ 'drag-over': dragHoveredFolderId === 'root' }" @drop.stop="handleDropNoteOnRoot($event)">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="folders.length === 0 && (!notes || notes.length === 0) && level === 0" class="sidebar-state">Empty</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.nested-list { display: flex; flex-direction: column; gap: 2px; }
|
||||||
|
|
||||||
|
.folder-item { display: flex; flex-direction: column; cursor: default; border-radius: 10px; }
|
||||||
|
.folder-item.drag-over { background: var(--color-button-hover); }
|
||||||
|
|
||||||
|
.folder-toggle { width: 100%; padding: 6px 8px; margin: 0; border: none; background: transparent; display: flex; align-items: center; gap: 6px; cursor: grab; border-radius: 10px; color: var(--color-text); font-size: inherit; transition: background-color 0.15s ease; }
|
||||||
|
.folder-toggle:hover { background: var(--color-background-soft); }
|
||||||
|
|
||||||
|
.folder-arrow { width: 14px; height: 14px; filter: invert(var(--color-icon-invert)); opacity: 0.5; }
|
||||||
|
.folder-icon { width: 16px; height: 16px; filter: invert(var(--color-icon-invert)); }
|
||||||
|
.folder-name { font-weight: 500; flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
|
||||||
|
.folder-children { padding-left: 20px; margin-top: 2px; cursor: default; }
|
||||||
|
.folder-children.drag-over { background: #ffffff22; border-radius: 10px; }
|
||||||
|
|
||||||
|
.note-link { width: 100%; padding: 6px; margin: 0; box-shadow: none; border: none; display: flex; flex-direction: column; align-items: flex-start; text-align: left; cursor: grab; }
|
||||||
|
.note-link-title { font-weight: 600; word-break: break-word; }
|
||||||
|
|
||||||
|
.sidebar-state { padding: 12px; border-radius: 10px; background: var(--color-background-soft); font-size: 14px; }
|
||||||
|
|
||||||
|
.root-drop-zone { min-height: 24px; position: relative; transition: background-color 0.15s ease, border-color 0.15s ease; border-radius: 10px; }
|
||||||
|
.root-drop-zone.drag-over { background: var(--color-button-hover); }
|
||||||
|
</style>
|
||||||
33
frontend/app/components/partials/Spinner.vue
Normal file
33
frontend/app/components/partials/Spinner.vue
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
size: {
|
||||||
|
type: Number,
|
||||||
|
default: 10
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="spinner">
|
||||||
|
<span
|
||||||
|
class="spinner-inner"
|
||||||
|
:style="{ width: size + 'px', height: size + 'px' }"
|
||||||
|
></span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.spinner-inner {
|
||||||
|
border: 2px solid white;
|
||||||
|
border-top: 2px solid transparent;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: inline-block;
|
||||||
|
animation: spin 0.7s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
25
frontend/app/components/partials/VersionRender.vue
Normal file
25
frontend/app/components/partials/VersionRender.vue
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<script setup>
|
||||||
|
const config = useRuntimeConfig()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="version-render">
|
||||||
|
<span>Dragonroll {{ config.public.gitTag }}-{{ config.public.gitCommit }}@{{ config.public.gitBranch }}</span>
|
||||||
|
<br><span>{{ config.public.buildDate }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.version-render {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
user-select: none;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
span{
|
||||||
|
color: rgb(59, 59, 59);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,12 +1,19 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import TopSearchBar from './topbar/TopSearchBar.vue';
|
import TopSearchBar from './topbar/TopSearchBar.vue';
|
||||||
|
|
||||||
|
const campaignName = computed(() => {
|
||||||
|
return 'Campaign';
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="top-bar">
|
<div class="top-bar">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<span class="top-bar-title"></span>
|
<span class="top-bar-title">
|
||||||
|
<img src="/img/logo.png" alt="Dragonroll Logo" class="logo">
|
||||||
|
<span>{{ campaignName }}</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<TopSearchBar></TopSearchBar>
|
<TopSearchBar></TopSearchBar>
|
||||||
@@ -25,17 +32,32 @@ import TopSearchBar from './topbar/TopSearchBar.vue';
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
height: 32px;
|
||||||
|
width: 32px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.left, .right {
|
.left, .right {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
text-align: right;
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-bar-title {
|
.top-bar-title {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
margin-left: 48px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -1,16 +1,13 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import NoteContainer from './NoteContainer.vue';
|
import NoteContainer from './NoteContainer.vue';
|
||||||
|
|
||||||
const emitter = useEmitter();
|
|
||||||
|
|
||||||
function hideSearch(){
|
|
||||||
emitter.emit("hide-search-container");
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="content" v-on:click="hideSearch">
|
<div class="content">
|
||||||
<NoteContainer></NoteContainer>
|
<NoteContainer>
|
||||||
|
|
||||||
|
</NoteContainer>
|
||||||
<!-- PowerMod -->
|
<!-- PowerMod -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -18,6 +15,7 @@ function hideSearch(){
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.content {
|
.content {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
min-width: 0; /* 👈 important */
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -1,56 +1,118 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, onUnmounted, ref, createApp } from 'vue';
|
||||||
|
import ToastManager from '~/components/managers/ToastManager.vue';
|
||||||
|
import { emitter } from '~/services/Emitter';
|
||||||
|
import { GetWidget, ParseMarkdown } from '~/services/Marker';
|
||||||
|
import Server from '~/services/Server';
|
||||||
|
import { DisplayToast } from '~/services/Toaster';
|
||||||
|
import TestWidget from '../widgets/TestWidget.vue';
|
||||||
|
|
||||||
// import { GetNote, GetContent } from '@/services/Content';
|
// import { GetNote, GetContent } from '@/services/Content';
|
||||||
const props = defineProps(['text', 'title', 'noteKey']);
|
const props = defineProps(['text', 'title', 'noteKey']);
|
||||||
|
const noteContent = ref(null); // Markdown text
|
||||||
|
|
||||||
const noteContent = ref(null);
|
const sourceText = ref(''); // Original markdown source, used for editing
|
||||||
|
const displayText = ref(''); // Compiled HTML from markdown
|
||||||
|
|
||||||
const emitter = useEmitter();
|
const editingMode = ref(false);
|
||||||
|
const title = ref(props.title);
|
||||||
|
const isDirty = ref(false);
|
||||||
|
const showClose = ref(false);
|
||||||
|
|
||||||
function gotoNote(){
|
let savedState = { text: '', title: '' };
|
||||||
// emitter.emit('goto-note', props.noteKey);
|
|
||||||
|
function markDirty() {
|
||||||
|
isDirty.value = sourceText.value !== savedState.text || title.value !== savedState.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeNote(){
|
|
||||||
// emitter.emit('delete-note', props.noteKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
onMounted(() => {
|
|
||||||
let content = GetContent();
|
|
||||||
let elements = noteContent.value.getElementsByTagName('a');
|
|
||||||
for(let i = 0, len = elements.length; i < len; i++) {
|
|
||||||
let link = elements[i].pathname.split('/').slice(1).join('');
|
|
||||||
link = decodeURIComponent(link);
|
|
||||||
if(content[link] !== undefined){
|
|
||||||
elements[i].onclick = function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
GetNote(link, (result) => {
|
|
||||||
emitter.emit("push-note", {key: link, text: "<h1>" + result.title + "</h1>" + result.html, title: result.title});
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
elements[i].classList.add("error-link");
|
|
||||||
elements[i].onclick = function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => setupCallout(), 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
function closeNote(){
|
function closeNote(){
|
||||||
emitter.emit('delete-note', props.noteKey);
|
emitter.emit('delete-note', props.noteKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotoNote(){
|
const compiledMarkdown = computed(() => {
|
||||||
// emitter.emit('goto-note', props.noteKey);
|
return ParseMarkdown(sourceText.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
function mountComponents() {
|
||||||
|
// Should no need more
|
||||||
|
const widget_types = ['display', 'inline'];
|
||||||
|
widget_types.forEach((widget_type) => {
|
||||||
|
const nodes = document.querySelectorAll('.vue-component-' + widget_type);
|
||||||
|
nodes.forEach(el => {
|
||||||
|
const app = createApp(GetWidget(widget_type, el.dataset.component), { content: el.dataset.content });
|
||||||
|
app.mount(el);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
///
|
||||||
|
|
||||||
|
function update(){
|
||||||
|
displayText.value = compiledMarkdown.value;
|
||||||
|
setTimeout(() => {
|
||||||
|
setupCallout()
|
||||||
|
mountComponents();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(sourceText, markDirty);
|
||||||
|
|
||||||
|
watch(title, markDirty);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
sourceText.value = props.text;
|
||||||
|
title.value = props.title;
|
||||||
|
|
||||||
|
savedState = { text: props.text, title: props.title };
|
||||||
|
emitter.on('title-updated', handleTitleUpdate);
|
||||||
|
// window.addEventListener('keydown', handleKeydown);
|
||||||
|
setTimeout(() => setupCallout(), 0);
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleTitleUpdate(data) {
|
||||||
|
if (data.key !== props.noteKey) return;
|
||||||
|
title.value = data.title;
|
||||||
|
savedState.title = data.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
emitter.off('title-updated', handleTitleUpdate);
|
||||||
|
// window.removeEventListener('keydown', handleKeydown);
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleKeydown(e) {
|
||||||
|
// Check for Ctrl + E (or Cmd + E on Mac)
|
||||||
|
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'e') {
|
||||||
|
e.preventDefault(); // prevent browser default behavior
|
||||||
|
editingMode.value = !editingMode.value;
|
||||||
|
if(!editingMode.value){
|
||||||
|
update();
|
||||||
|
SaveNote(); // Save when switching to display mode
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 's') {
|
||||||
|
e.preventDefault(); // prevent browser default behavior
|
||||||
|
// Save the note (you can emit an event or call a method here)
|
||||||
|
SaveNote();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function SaveNote(){
|
||||||
|
Server().post('/note/update', {
|
||||||
|
id: props.noteKey,
|
||||||
|
content: sourceText.value,
|
||||||
|
title: title.value,
|
||||||
|
}).then((response) => {
|
||||||
|
if(response.data.status !== 'ok'){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
savedState = { text: sourceText.value, title: title.value };
|
||||||
|
isDirty.value = false;
|
||||||
|
}).catch((error) => {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleCallout() {
|
function toggleCallout() {
|
||||||
@@ -78,6 +140,10 @@ function toggleCallout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupCallout() {
|
function setupCallout() {
|
||||||
|
if (!noteContent.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const collapsible = noteContent.value.getElementsByClassName(
|
const collapsible = noteContent.value.getElementsByClassName(
|
||||||
`callout is-collapsible`,
|
`callout is-collapsible`,
|
||||||
);
|
);
|
||||||
@@ -93,21 +159,31 @@ function setupCallout() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="note">
|
<div class="note" @keydown="handleKeydown" tabindex="0">
|
||||||
<div class="note-stunt" v-on:click="gotoNote">
|
<div class="note-stunt">
|
||||||
<div class="close-button" v-on:click="closeNote">
|
<div class="unsaved-wrapper" v-if="isDirty">
|
||||||
|
<div class="unsaved-dot"></div>
|
||||||
|
<div class="close-button close-hidden" v-on:click="closeNote">
|
||||||
|
<img class="icon" src="/icons/Pixelarticons/white/close.svg" alt="My Happy SVG"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="close-button" v-else v-on:click="closeNote">
|
||||||
<img class="icon" src="/icons/Pixelarticons/white/close.svg" alt="My Happy SVG"/>
|
<img class="icon" src="/icons/Pixelarticons/white/close.svg" alt="My Happy SVG"/>
|
||||||
</div>
|
</div>
|
||||||
<span>{{ title }}</span>
|
<span>{{ title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="note-content-container">
|
<div class="note-content-container">
|
||||||
<div class="note-content" ref="noteContent" v-html="text"></div>
|
<textarea v-model="sourceText" class="full-editor" v-if="editingMode"></textarea>
|
||||||
|
<div v-else class="note-content" ref="noteContent">
|
||||||
|
<h1>{{ title }}</h1>
|
||||||
|
<div ref="noteContent" v-html="displayText"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -124,6 +200,62 @@ function setupCallout() {
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unsaved-wrapper {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unsaved-dot {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #ffffff;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-hidden {
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
transition: opacity 0.15s ease, visibility 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unsaved-wrapper:hover .close-hidden {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unsaved-wrapper:hover .unsaved-dot {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-editor {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
resize: none;
|
||||||
|
|
||||||
|
padding: 20px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-family: monospace; /* optional, gives document/editor feel */
|
||||||
|
|
||||||
|
padding-bottom: 400px; /* Small bottom margin */
|
||||||
|
}
|
||||||
|
|
||||||
.close-button {
|
.close-button {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
@@ -131,6 +263,7 @@ function setupCallout() {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
filter: invert(var(--color-icon-invert));
|
||||||
}
|
}
|
||||||
|
|
||||||
.note {
|
.note {
|
||||||
@@ -138,34 +271,32 @@ function setupCallout() {
|
|||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
border-color: var(--note-border-color);
|
border-color: var(--color-note-border);
|
||||||
border-width: 0px;
|
border-width: 0px;
|
||||||
border-right-width: 1px;
|
border-right-width: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
background-color: var(--background-color);
|
background-color: var(--color-background);
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Contingut de cada nota */
|
/* Contingut de cada nota */
|
||||||
.note-content {
|
.note-content {
|
||||||
padding-bottom: 60px;
|
padding-bottom: 400px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
max-width: 600px;
|
||||||
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.note-content-container {
|
.note-content-container {
|
||||||
margin: 20px;
|
width: 100%;
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.note-content > h1 {
|
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.note-content .katex-display {
|
.note-content :deep(img) {
|
||||||
max-width: 600px;
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
display: block; /* optional: avoids inline spacing issues */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue';
|
import { onMounted, onUnmounted, ref } from 'vue';
|
||||||
import Note from './Note.vue';
|
import Note from './Note.vue';
|
||||||
import { emitter } from '~/services/Emitter';
|
import { emitter } from '~/services/Emitter';
|
||||||
|
|
||||||
@@ -9,6 +9,10 @@ const noteContainer = ref(null);
|
|||||||
|
|
||||||
function calculateContainerWidth(){
|
function calculateContainerWidth(){
|
||||||
let dom = noteContainer.value;
|
let dom = noteContainer.value;
|
||||||
|
if (!dom) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dom.style.width = noteData.value.length * 701 + "px";
|
dom.style.width = noteData.value.length * 701 + "px";
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -22,19 +26,42 @@ function calculateContainerWidth(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pushNote(note){
|
function pushNote(note){
|
||||||
|
noteData.value = noteData.value.filter((currentNote) => {
|
||||||
|
return currentNote.key !== note.key;
|
||||||
|
});
|
||||||
noteData.value.push(note);
|
noteData.value.push(note);
|
||||||
calculateContainerWidth();
|
calculateContainerWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
emitter.on("push-note", (note) => {
|
function handlePushNote(note) {
|
||||||
pushNote(note);
|
pushNote(note);
|
||||||
})
|
}
|
||||||
|
|
||||||
emitter.on("delete-note", (key) => {
|
function handleDeleteNote(key) {
|
||||||
noteData.value = noteData.value.filter((note) => {
|
noteData.value = noteData.value.filter((note) => {
|
||||||
return note.key !== key;
|
return note.key !== key;
|
||||||
});
|
});
|
||||||
calculateContainerWidth();
|
calculateContainerWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Moure aixo
|
||||||
|
onMounted(() => {
|
||||||
|
emitter.on("push-note", handlePushNote);
|
||||||
|
emitter.on("delete-note", handleDeleteNote);
|
||||||
|
emitter.on("title-updated", handleTitleUpdated);
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleTitleUpdated(data) {
|
||||||
|
const note = noteData.value.find(n => n.key === data.key);
|
||||||
|
if (note) {
|
||||||
|
note.title = data.title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
emitter.off("push-note", handlePushNote);
|
||||||
|
emitter.off("delete-note", handleDeleteNote);
|
||||||
|
emitter.off("title-updated", handleTitleUpdated);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -59,7 +86,6 @@ emitter.on("delete-note", (key) => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: 100%;
|
|
||||||
background-color: var(--color-background);
|
background-color: var(--color-background);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
75
frontend/app/components/viewer/topbar/SearchResult.vue
Normal file
75
frontend/app/components/viewer/topbar/SearchResult.vue
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
title: { type: String, default: '' },
|
||||||
|
subtitle: { type: String, default: '' },
|
||||||
|
link: { type: String, default: '' },
|
||||||
|
icon: { type: String, default: '' }
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['select']);
|
||||||
|
|
||||||
|
function handleSelect() {
|
||||||
|
emit('select', { title: props.title, subtitle: props.subtitle, link: props.link });
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<button class="search-result" @click="handleSelect">
|
||||||
|
<div class="search-result-left">
|
||||||
|
<img v-if="icon" class="result-icon" :src="icon" alt="">
|
||||||
|
<span class="result-title">{{ title }}</span>
|
||||||
|
</div>
|
||||||
|
<span v-if="subtitle" class="result-subtitle">{{ subtitle }}</span>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.search-result {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 8px 12px;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: inherit;
|
||||||
|
text-align: left;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: background-color 0.1s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-result:hover,
|
||||||
|
.search-result.selected {
|
||||||
|
background-color: var(--color-search-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-result-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-icon {
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
filter: invert(var(--color-icon-invert));
|
||||||
|
opacity: 0.6;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-title {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-subtitle {
|
||||||
|
font-size: 12px;
|
||||||
|
opacity: 0.5;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,58 +1,261 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import { ref, onMounted, onUnmounted } from 'vue';
|
||||||
import SearchIcon from 'pixelarticons/svg/search.svg'
|
import SearchIcon from 'pixelarticons/svg/search.svg'
|
||||||
/*
|
import PlusIcon from 'pixelarticons/svg/plus.svg'
|
||||||
import { ref, onMounted } from 'vue';
|
import NoteSearchResult from './SearchResult.vue';
|
||||||
import { GetArrayContent, GetContent } from '@/services/Content';
|
import Server from '~/services/Server';
|
||||||
import useEmitter from '@/services/Emitter';
|
import { emitter } from '~/services/Emitter';
|
||||||
|
import { register, search as searchActions, execute as executeAction } from '~/services/ActionRegistry';
|
||||||
|
import { useCampaignService } from '~/services/Campaign.js';
|
||||||
|
|
||||||
const emitter = useEmitter();
|
const { Campaign } = useCampaignService();
|
||||||
|
|
||||||
import NoteSearchElement from "@/components/topbar/NoteSearchElement.vue";
|
const inputText = ref('');
|
||||||
|
const notes = ref([]);
|
||||||
|
|
||||||
let noteLinks = ref([]);
|
const showResults = ref(false);
|
||||||
let searchContainer = ref(null);
|
const selectedIndex = ref(-1);
|
||||||
|
|
||||||
emitter.on("hide-search-container", () => {
|
const focusInput = ref(null);
|
||||||
searchContainer.value.style.display = "none";
|
|
||||||
})
|
|
||||||
|
|
||||||
function updateList(event){
|
// ---- Keyboard shortcut to open search ----
|
||||||
let content = GetArrayContent();
|
function globalKeydown(e) {
|
||||||
let query = "";
|
const modKey = e.metaKey || e.ctrlKey;
|
||||||
if(event !== undefined) query = event.target.value;
|
if ((modKey && e.key === 'k') || (e.key === '/' && !isInputFocused())) {
|
||||||
let filter = query.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toUpperCase().trim();
|
e.preventDefault();
|
||||||
|
focusInput.value?.focus();
|
||||||
|
}
|
||||||
|
if (e.key === 'Escape' && showResults.value) {
|
||||||
|
closeResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
noteLinks.value = content.filter((noteInfo) => {
|
function isInputFocused() {
|
||||||
return noteInfo["title"].normalize("NFD").replace(/[\u0300-\u036f]/g, "").toUpperCase().indexOf(filter) > -1;
|
const tag = document.activeElement?.tagName.toLowerCase();
|
||||||
|
return tag === 'input' || tag === 'textarea' || document.activeElement?.isContentEditable;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Registration of create-note action (extensibile for future commands) ----
|
||||||
|
function registerCreateNoteAction() {
|
||||||
|
const action = {
|
||||||
|
id: 'create_note',
|
||||||
|
label: 'New note',
|
||||||
|
description: 'Create a new note in the current campaign',
|
||||||
|
execute: async () => {
|
||||||
|
if (!Campaign.value) return;
|
||||||
|
const campaignId = Campaign.value?._id ?? Campaign.value?.id;
|
||||||
|
try {
|
||||||
|
const response = await Server().post('/note/create', {
|
||||||
|
title: 'New note',
|
||||||
|
content: '',
|
||||||
|
campaign: campaignId
|
||||||
});
|
});
|
||||||
|
if (response.data.status !== 'ok') return;
|
||||||
|
emitter.emit('note-created', response.data.note);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[ActionRegistry] Failed to create note:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
register(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchFocus(event){
|
// ---- Note search ----
|
||||||
if(GetContent() === undefined) return;
|
async function fetchNotes() {
|
||||||
|
if (!Campaign.value) return;
|
||||||
|
|
||||||
searchContainer.value.style.display = "";
|
const campaignId = Campaign.value?._id ?? Campaign.value?.id;
|
||||||
updateList(undefined);
|
try {
|
||||||
|
const response = await Server().get('/note/list', { params: { campaign: campaignId } });
|
||||||
|
if (response.data.status !== 'ok') {
|
||||||
|
notes.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
notes.value = response.data.notes.map(n => ({
|
||||||
|
key: n._id,
|
||||||
|
title: n.title || 'Untitled',
|
||||||
|
date: n.date
|
||||||
|
}));
|
||||||
|
} catch (err) {
|
||||||
|
notes.value = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openNote(note) {
|
||||||
|
emitter.emit('push-note', note);
|
||||||
|
closeResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Unified results: notes + command actions ----
|
||||||
|
function getCombinedResults(query) {
|
||||||
|
const combined = [];
|
||||||
|
|
||||||
|
if (query && query.trim().length > 0) {
|
||||||
|
const q = query.normalize("NFD").replace(/[\u036f]/g, "").toLowerCase().trim();
|
||||||
|
|
||||||
|
// Filter notes that match the query text
|
||||||
|
const matchingNotes = notes.value.filter(note => {
|
||||||
|
const title = (note.title || '').normalize("NFD").replace(/[\u036f]/g, "").toLowerCase();
|
||||||
|
return title.includes(q);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const note of matchingNotes) {
|
||||||
|
combined.push({ type: 'note', data: note });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search command actions
|
||||||
|
const matchedActions = searchActions(query);
|
||||||
|
for (const action of matchedActions) {
|
||||||
|
combined.push({ type: 'action', data: action });
|
||||||
|
}
|
||||||
|
} else if (query === '' || query === null) {
|
||||||
|
// Empty query - show all notes + all actions
|
||||||
|
for (const note of notes.value) {
|
||||||
|
combined.push({ type: 'note', data: note });
|
||||||
|
}
|
||||||
|
const allActions = searchActions('');
|
||||||
|
for (const action of allActions) {
|
||||||
|
combined.push({ type: 'action', data: action });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return combined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Input handling ----
|
||||||
|
function onInput(event) {
|
||||||
|
const query = event.target.value;
|
||||||
|
inputText.value = query;
|
||||||
|
selectedIndex.value = -1;
|
||||||
|
|
||||||
|
if (!query || query.trim() === '') {
|
||||||
|
showResults.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showResults.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onFocus() {
|
||||||
|
if (notes.value.length === 0) {
|
||||||
|
fetchNotes().then(() => {
|
||||||
|
showResults.value = true;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
showResults.value = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBlur(event) {
|
||||||
|
// Delay closing to allow click on results
|
||||||
|
setTimeout(() => {
|
||||||
|
closeResults();
|
||||||
|
}, 150);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onKeydown(event) {
|
||||||
|
const combined = getCombinedResults(inputText.value);
|
||||||
|
|
||||||
|
if (event.key === 'ArrowDown') {
|
||||||
|
event.preventDefault();
|
||||||
|
selectedIndex.value = Math.min(selectedIndex.value + 1, combined.length - 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === 'ArrowUp') {
|
||||||
|
event.preventDefault();
|
||||||
|
selectedIndex.value = Math.max(selectedIndex.value - 1, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
event.preventDefault();
|
||||||
|
if (selectedIndex.value >= 0) {
|
||||||
|
const item = combined[selectedIndex.value];
|
||||||
|
if (!item) return;
|
||||||
|
|
||||||
|
if (item.type === 'note') {
|
||||||
|
openNote(item.data);
|
||||||
|
} else if (item.type === 'action') {
|
||||||
|
executeAction(item.data.id);
|
||||||
|
closeResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
closeResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSelect(result) {
|
||||||
|
if (!result) return;
|
||||||
|
|
||||||
|
if (result.link) {
|
||||||
|
const note = notes.value.find(n => n.key === result.link);
|
||||||
|
if (note) openNote(note);
|
||||||
|
}
|
||||||
|
closeResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleActionSelect(actionData) {
|
||||||
|
executeAction(actionData.id);
|
||||||
|
closeResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeResults() {
|
||||||
|
showResults.value = false;
|
||||||
|
selectedIndex.value = -1;
|
||||||
|
inputText.value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Clean up register action on mount/unmount ----
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
document.addEventListener('keydown', globalKeydown);
|
||||||
|
registerCreateNoteAction();
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
document.removeEventListener('keydown', globalKeydown);
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="top-search-container">
|
<div class="top-search-container">
|
||||||
<div class="top-search-box">
|
<div class="top-search-box">
|
||||||
<img class="icon search-icon" :src="SearchIcon" alt="My Happy SVG"/>
|
<img class="icon search-icon" :src="SearchIcon" alt="" aria-hidden="true">
|
||||||
<!-- <input type="text" v-on:input="updateList" v-on:focus="searchFocus" class="search-prompt" placeholder="Buscar...">-->
|
<input
|
||||||
<input type="text" class="search-prompt" placeholder="Buscar...">
|
ref="focusInput"
|
||||||
|
type="text"
|
||||||
|
class="search-prompt"
|
||||||
|
placeholder="Search or press Cmd+K..."
|
||||||
|
v-model="inputText"
|
||||||
|
@input="onInput"
|
||||||
|
@focus="onFocus"
|
||||||
|
@blur="onBlur"
|
||||||
|
@keydown="onKeydown"
|
||||||
|
autocomplete="off"
|
||||||
|
spellcheck="false"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="search-container" ref="searchContainer" v-on:focusout="searchFocusout" style="display: none;">-->
|
<div class="search-container" v-if="showResults">
|
||||||
<div class="search-container" style="display: none;">
|
<template v-if="getCombinedResults(inputText).length === 0 && inputText.trim()">
|
||||||
|
<div class="search-empty">No results found</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<div class="search-container-list">
|
<div class="search-container-list">
|
||||||
<!--
|
<NoteSearchResult
|
||||||
<NoteSearchElement v-for="element in noteLinks" :key="element.key" :title="element.title" :link="element.key"></NoteSearchElement>
|
v-for="(item, index) in getCombinedResults(inputText)"
|
||||||
-->
|
:key="(item.data.key || item.data.id) + '-' + index"
|
||||||
|
:title="item.type === 'note' ? item.data.title : item.data.label"
|
||||||
|
:subtitle="item.type === 'action' ? item.data.description : ''"
|
||||||
|
:link="item.type === 'note' ? item.data.key : null"
|
||||||
|
:icon="item.type === 'action' ? PlusIcon : ''"
|
||||||
|
:class="{ selected: index === selectedIndex }"
|
||||||
|
@select="onSelect"
|
||||||
|
@click.stop.prevent="() => { if (item.type === 'note') openNote(item.data); else handleActionSelect(item.data); }"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -63,12 +266,13 @@ onMounted(() => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-search-box {
|
.top-search-box {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: var(--search-background);
|
background-color: var(--color-search-background);
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
@@ -80,6 +284,7 @@ onMounted(() => {
|
|||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
background: none;
|
background: none;
|
||||||
margin-left: -5px;
|
margin-left: -5px;
|
||||||
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-prompt:focus {
|
.search-prompt:focus {
|
||||||
@@ -88,23 +293,39 @@ onMounted(() => {
|
|||||||
|
|
||||||
.search-icon {
|
.search-icon {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
filter: invert(var(--color-icon-invert));
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-container {
|
.search-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: var(--search-background-container);
|
background-color: var(--color-search-background-container);
|
||||||
top: 45px;
|
top: 45px;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
max-width: 800px;
|
max-width: 600px;
|
||||||
max-height: 500px;
|
max-height: 400px;
|
||||||
overflow-y: scroll;
|
overflow-y: auto;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
backdrop-filter: blur(15px);
|
backdrop-filter: blur(15px);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
min-width: 400px;
|
width: calc(30vw + 400px);
|
||||||
min-height: 500px;
|
min-width: 320px;
|
||||||
z-index: 99999;
|
z-index: 99999;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-container-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-empty {
|
||||||
|
padding: 16px;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0.5;
|
||||||
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
3
frontend/app/components/viewer/widgets/TableWidget.vue
Normal file
3
frontend/app/components/viewer/widgets/TableWidget.vue
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
13
frontend/app/components/viewer/widgets/TestWidget.vue
Normal file
13
frontend/app/components/viewer/widgets/TestWidget.vue
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<script setup>
|
||||||
|
const props = defineProps(['content']);
|
||||||
|
|
||||||
|
const name = ref('');
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
name.value = props.content || 'No content';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<h2>This is a {{name}} widget</h2>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
<script setup>
|
||||||
|
const props = defineProps(['content']);
|
||||||
|
|
||||||
|
import { parse } from '~/services/widgets/DiceParser';
|
||||||
|
import { AddSound } from '~/services/Sound';
|
||||||
|
|
||||||
|
const container = ref(null);
|
||||||
|
const resultText = ref("");
|
||||||
|
const steps = ref(null);
|
||||||
|
const stepsHtml = ref("");
|
||||||
|
|
||||||
|
const rollDice = () => {
|
||||||
|
const result = parse(props.content);
|
||||||
|
resultText.value = result.total;
|
||||||
|
stepsHtml.value = result.steps.map(renderStep).join('');
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderStep = (s) => {
|
||||||
|
if (s.type === 'op') {
|
||||||
|
const label = s.op === '*' ? '×' : s.op === '/' ? '÷' : s.op;
|
||||||
|
return `<span class="step-op">${label}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.type === 'const') {
|
||||||
|
return `<span class="step-const">${s.value}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.type === 'dice') {
|
||||||
|
const { entry } = s;
|
||||||
|
const { rawRolls, kept, sides, mod, value } = entry;
|
||||||
|
|
||||||
|
const keptCopy = [...kept];
|
||||||
|
const tagged = rawRolls.map(v => {
|
||||||
|
const i = keptCopy.indexOf(v);
|
||||||
|
if (i !== -1) { keptCopy.splice(i, 1); return { v, kept: true }; }
|
||||||
|
return { v, kept: false };
|
||||||
|
});
|
||||||
|
|
||||||
|
let html = '';
|
||||||
|
|
||||||
|
tagged.forEach(({ v, kept }) => {
|
||||||
|
const isMax = v === sides, isMin = v === 1;
|
||||||
|
const cls = !kept ? 'roll-val dropped'
|
||||||
|
: isMax ? 'roll-val max-val'
|
||||||
|
: isMin ? 'roll-val min-val'
|
||||||
|
: 'roll-val kept';
|
||||||
|
html += `<span class="${cls}">${v}</span>`;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (kept.length < rawRolls.length || kept.length > 1) {
|
||||||
|
html += `<span class="step-sum">=${value}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
AddSound(container.value);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="roll-widget" ref="container">
|
||||||
|
<div class="roll-widget-body">
|
||||||
|
<span class="result-text">{{ resultText || '-' }}</span>
|
||||||
|
<button class="btn-primary roll-btn sound-click" @click="rollDice">
|
||||||
|
<span class="dice-content">
|
||||||
|
<!-- Dice icon (SVG) -->
|
||||||
|
<img class="icon" src="/icons/iconoir/regular/dice-three.svg" draggable="false">
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="roll-widget-results">
|
||||||
|
<span class="formula">{{ "[" + props.content + "]" }}</span>
|
||||||
|
<div class="steps" v-html="stepsHtml"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.steps {
|
||||||
|
margin-left: 8px;
|
||||||
|
height: 22px;
|
||||||
|
> {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.steps :deep(.roll-val){
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 18px;
|
||||||
|
padding: 1px 2px;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
border: 1px solid;
|
||||||
|
}
|
||||||
|
.steps :deep(.roll-val.kept){
|
||||||
|
background: rgba(93,184,122,0.12);
|
||||||
|
border-color: #4a8c5c;
|
||||||
|
color: #a8d4b4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps :deep(.roll-val.dropped) {
|
||||||
|
background: transparent;
|
||||||
|
border-color: var(--color-border);
|
||||||
|
color: var(--color-text-tertiary);
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps :deep(.roll-val.max-val) {
|
||||||
|
background: rgba(93,184,122,0.2);
|
||||||
|
border-color: #5db87a;
|
||||||
|
color: #5db87a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps :deep(.roll-val.min-val) {
|
||||||
|
background: rgba(201,95,95,0.12);
|
||||||
|
border-color: #c95f5f;
|
||||||
|
color: #c95f5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.steps :deep(.step-op) { color: var(--color-text-secondary); padding: 0 4px; font-size: 13px; }
|
||||||
|
.steps :deep(.step-const) { font-size: 13px; color: var(--color-text-primary); padding: 0 2px; }
|
||||||
|
.steps :deep(.step-dice-label) { font-size: 11px; color: var(--color-text-tertiary); margin-right: 2px; }
|
||||||
|
.steps :deep(.step-sum) { font-size: 11px; color: var(--color-text-tertiary); margin-left: 2px; }
|
||||||
|
.steps :deep(.dice-mod) { font-style: normal; margin-left: 2px; }
|
||||||
|
|
||||||
|
.result-text {
|
||||||
|
font-size: 24px;
|
||||||
|
vertical-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roll-widget-body {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-text {
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formula {
|
||||||
|
margin-left: 12px;
|
||||||
|
font-family: ui-monospace, monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--color-gray);
|
||||||
|
}
|
||||||
|
|
||||||
|
.roll-widget-results {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roll-widget {
|
||||||
|
width: 100%;
|
||||||
|
background-color: var(--color-background-light);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roll-btn {
|
||||||
|
padding: 8px;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<script setup>
|
||||||
|
const props = defineProps(['content']);
|
||||||
|
|
||||||
|
import { parse } from '~/services/widgets/DiceParser';
|
||||||
|
import { AddSound } from '~/services/Sound';
|
||||||
|
|
||||||
|
const container = ref(null);
|
||||||
|
const resultText = ref("");
|
||||||
|
|
||||||
|
const rollDice = () => {
|
||||||
|
console.log(props.content);
|
||||||
|
const result = parse(props.content);
|
||||||
|
console.log(result);
|
||||||
|
resultText.value = result.total;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
AddSound(container.value);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="roll-widget" ref="container">
|
||||||
|
<div class="roll-widget-body">
|
||||||
|
<button class="btn-primary btn-inline sound-click" @click="rollDice">
|
||||||
|
<span class="dice-content">
|
||||||
|
<!-- Dice icon (SVG) -->
|
||||||
|
<img class="icon" src="/icons/iconoir/regular/dice-three.svg" draggable="false">
|
||||||
|
|
||||||
|
<!-- Result text -->
|
||||||
|
<span class="result-text">
|
||||||
|
{{ resultText || props.content }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.roll-widget {
|
||||||
|
display: inline-flex; /* or inline-block */
|
||||||
|
vertical-align: middle; /* keeps it aligned nicely with text */
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-inline {
|
||||||
|
padding: 2px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dice-content {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-text {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
144
frontend/app/components/windows/CreateCampaignWindow.vue
Normal file
144
frontend/app/components/windows/CreateCampaignWindow.vue
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
import { SetupHandle, SetSize, ResetPosition, Top, ClearWindow } from '@/services/Windows';
|
||||||
|
|
||||||
|
import WindowHandle from './partials/WindowHandle.vue';
|
||||||
|
import ColorPicker from '../layouts/ColorPicker.vue';
|
||||||
|
import Server from '~/services/Server';
|
||||||
|
import { DisplayToast } from '~/services/Toaster';
|
||||||
|
|
||||||
|
const handle = ref(null);
|
||||||
|
const wrapper = ref(null);
|
||||||
|
|
||||||
|
const props = defineProps(['data']);
|
||||||
|
const data = props.data;
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
let id = data.id;
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
Top(wrapper);
|
||||||
|
SetupHandle(id, handle);
|
||||||
|
SetSize(id, {width: 500, height: 400});
|
||||||
|
ResetPosition(id, "center");
|
||||||
|
});
|
||||||
|
|
||||||
|
const campaignName = ref("");
|
||||||
|
const campaignDescription = ref("");
|
||||||
|
const colorPicker = ref(null);
|
||||||
|
|
||||||
|
function NewCampaign(){
|
||||||
|
const color = colorPicker.value.GetColor();
|
||||||
|
console.log(color);
|
||||||
|
loading.value = true;
|
||||||
|
Server().post('/campaign/create', {
|
||||||
|
name: campaignName.value,
|
||||||
|
description: campaignDescription.value,
|
||||||
|
color: colorPicker.value.GetColor(),
|
||||||
|
}).then((response) => {
|
||||||
|
loading.value = false;
|
||||||
|
console.log(response.data);
|
||||||
|
DisplayToast('green', $t('campaigns.create.success'), 3000);
|
||||||
|
ClearWindow({id});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="window-wrapper" :id="'window-wrapper-' + id" ref="wrapper">
|
||||||
|
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
||||||
|
|
||||||
|
<div class="body">
|
||||||
|
<!-- Body -->
|
||||||
|
<form v-on:submit.prevent="NewCampaign">
|
||||||
|
<div class="form-field">
|
||||||
|
<label>{{ $t('campaigns.create.name') }}</label>
|
||||||
|
<input type="text" :placeholder="$t('campaigns.create.enter')" name="campaignName" v-model="campaignName" autocomplete="off" >
|
||||||
|
</div>
|
||||||
|
<div class="form-field">
|
||||||
|
<label>{{ $t('campaigns.create.description') }}</label>
|
||||||
|
<textarea type="text" :placeholder="$t('campaigns.create.description-placeholder')" name="campaignDescription" v-model="campaignDescription" autocomplete="off" ></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-field">
|
||||||
|
<label>{{ $t('campaigns.create.color') }}</label>
|
||||||
|
<ColorPicker ref="colorPicker"></ColorPicker>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions">
|
||||||
|
<button class="btn-primary sound-click">
|
||||||
|
<span v-if="loading">
|
||||||
|
<Spinner />
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
{{ $t("general.create") }}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.window-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.window-second-header {
|
||||||
|
width: 100%;
|
||||||
|
h2 {
|
||||||
|
font-family: MrEavesRemake;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-field {
|
||||||
|
padding: 2px;
|
||||||
|
display: flex;
|
||||||
|
align-items: left;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
resize: none;
|
||||||
|
height: 200px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center; /* centers horizontally */
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions button {
|
||||||
|
width: 100%; /* makes it expand */
|
||||||
|
max-width: 300px; /* optional: prevents it from being too wide */
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { SetupHandle, SetSize, ResetPosition } from '@/services/Windows';
|
import { SetupHandle, SetSize, ResetPosition, Top } from '@/services/Windows';
|
||||||
|
|
||||||
import WindowHandle from './partials/WindowHandle.vue';
|
import WindowHandle from './partials/WindowHandle.vue';
|
||||||
|
|
||||||
const handle = ref(null);
|
const handle = ref(null);
|
||||||
|
const wrapper = ref(null);
|
||||||
|
|
||||||
const props = defineProps(['data']);
|
const props = defineProps(['data']);
|
||||||
const data = props.data;
|
const data = props.data;
|
||||||
|
|
||||||
let id = data.type;
|
let id = data.id;
|
||||||
|
|
||||||
const test = ref(null)
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
Top(wrapper);
|
||||||
SetupHandle(id, handle);
|
SetupHandle(id, handle);
|
||||||
SetSize(id, {width: 500, height: 380});
|
SetSize(id, {width: 500, height: 380});
|
||||||
ResetPosition(id, "center");
|
ResetPosition(id, "center");
|
||||||
@@ -22,7 +22,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="window-wrapper" :id="'window-wrapper-' + id">
|
<div class="window-wrapper" :id="'window-wrapper-' + id" ref="wrapper">
|
||||||
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Body -->
|
||||||
|
|||||||
@@ -5,65 +5,71 @@ import {
|
|||||||
SetSize,
|
SetSize,
|
||||||
ResetPosition,
|
ResetPosition,
|
||||||
SetResizable,
|
SetResizable,
|
||||||
SetMovable,
|
|
||||||
ClearWindow,
|
ClearWindow,
|
||||||
CreateWindow,
|
CreateWindow,
|
||||||
|
Top,
|
||||||
} from '@/services/Windows';
|
} from '@/services/Windows';
|
||||||
|
|
||||||
import WindowHandle from './partials/WindowHandle.vue';
|
import WindowHandle from './partials/WindowHandle.vue';
|
||||||
import { DisplayToast } from '~/services/Toaster';
|
import { DisplayToast } from '~/services/Toaster';
|
||||||
import Server from '~/services/Server';
|
import Server from '~/services/Server';
|
||||||
import { SetUser } from '~/services/User';
|
import { SetUser } from '~/services/User';
|
||||||
|
import Spinner from '../partials/Spinner.vue';
|
||||||
|
|
||||||
const handle = ref(null);
|
const handle = ref(null);
|
||||||
|
const wrapper = ref(null);
|
||||||
|
|
||||||
const props = defineProps(['data']);
|
const props = defineProps(['data']);
|
||||||
const data = props.data;
|
const data = props.data;
|
||||||
|
|
||||||
let id = data.type;
|
let id = data.id;
|
||||||
|
|
||||||
const username = ref("");
|
const username = ref("");
|
||||||
const password = ref("");
|
const password = ref("");
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
Top(wrapper);
|
||||||
SetupHandle(id, handle);
|
SetupHandle(id, handle);
|
||||||
SetSize(id, {width: 450, height: 480});
|
SetSize(id, {width: 450, height: 480});
|
||||||
SetResizable(id, false);
|
SetResizable(id, false);
|
||||||
ResetPosition(id, "center");
|
ResetPosition(id, "center");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function ShowMainMenu(){
|
||||||
|
CreateWindow('main_menu');
|
||||||
|
ClearWindow({type: 'login'});
|
||||||
|
}
|
||||||
|
|
||||||
function login() {
|
function login() {
|
||||||
Server().post('/user/login', { username: username.value, password: password.value }).then((response) => {
|
loading.value = true;
|
||||||
|
Server().post('/user/login', { usermail: username.value, password: password.value }).then((response) => {
|
||||||
|
loading.value = false;
|
||||||
const data = response.data;
|
const data = response.data;
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if(data.status == "error"){
|
if(data.status == "error"){
|
||||||
DisplayToast('red', "Wrong username or password", 3000)
|
DisplayToast('red', $t(data.msg), 3000)
|
||||||
} else {
|
} else {
|
||||||
SetUser(data.token);
|
SetUser(data.token);
|
||||||
|
DisplayToast('green', $t('login.success'), 3000);
|
||||||
ShowMainMenu();
|
ShowMainMenu();
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log(error);
|
loading.value = false;
|
||||||
if(error.response.status == 429){
|
DisplayToast('red', $t("errors.internal"), 3000);
|
||||||
// errorMessage.value = error.response.data;
|
|
||||||
} else {
|
|
||||||
// errorMessage.value = "Hi ha hagut un error intern, torna'ho a provar més tard";
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toRegister(){
|
function toRegister(){
|
||||||
CreateWindow('register');
|
CreateWindow('register');
|
||||||
ClearWindow('login');
|
ClearWindow({type: 'login'});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="window-wrapper" :id="'window-wrapper-' + id">
|
<div class="window-wrapper" :id="'window-wrapper-' + id" ref="wrapper">
|
||||||
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Body -->
|
||||||
@@ -84,7 +90,14 @@ function toRegister(){
|
|||||||
<input id="password-field" type="password" :placeholder="$t('login.password-placeholder')" name="password" v-model="password" autocomplete="off" >
|
<input id="password-field" type="password" :placeholder="$t('login.password-placeholder')" name="password" v-model="password" autocomplete="off" >
|
||||||
</div>
|
</div>
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<button class="btn-primary sound-click">{{$t('login.log-in')}}</button>
|
<button class="btn-primary sound-click">
|
||||||
|
<span v-if="loading">
|
||||||
|
<Spinner />
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
{{$t('login.log-in')}}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-field center">
|
<div class="form-field center">
|
||||||
<p>{{$t('login.no-account')}} <a href="#" @click.prevent="toRegister">{{$t('login.register')}}</a></p>
|
<p>{{$t('login.no-account')}} <a href="#" @click.prevent="toRegister">{{$t('login.register')}}</a></p>
|
||||||
|
|||||||
165
frontend/app/components/windows/MainMenuWindow.vue
Normal file
165
frontend/app/components/windows/MainMenuWindow.vue
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
import { SetupHandle, SetSize, ResetPosition, Top, CreateChildWindow, GetFirstWindowId } from '@/services/Windows';
|
||||||
|
|
||||||
|
import WindowHandle from './partials/WindowHandle.vue';
|
||||||
|
import VersionRender from '../partials/VersionRender.vue';
|
||||||
|
import EditUserPartial from '../partials/EditUserPartial.vue';
|
||||||
|
import CampaignEntry from '../partials/CampaignEntry.vue';
|
||||||
|
import Server from '~/services/Server';
|
||||||
|
|
||||||
|
const handle = ref(null);
|
||||||
|
const wrapper = ref(null);
|
||||||
|
|
||||||
|
const props = defineProps(['data']);
|
||||||
|
const data = props.data;
|
||||||
|
|
||||||
|
const campaings = ref([]);
|
||||||
|
|
||||||
|
let id = data.id;
|
||||||
|
|
||||||
|
function CreateCampaignWindow(){
|
||||||
|
CreateChildWindow(GetFirstWindowId('main_menu'), 'create_campaign');
|
||||||
|
}
|
||||||
|
|
||||||
|
function RefreshCampaigns(){
|
||||||
|
Server().get('/campaign/list').then((response) => {
|
||||||
|
if(response.data.status !== "ok") return;
|
||||||
|
response.data.campaigns.forEach((camp) => {
|
||||||
|
campaings.value.push(camp);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
Top(wrapper);
|
||||||
|
SetupHandle(id, handle);
|
||||||
|
SetSize(id, {width: 880, height: 760});
|
||||||
|
ResetPosition(id, "center");
|
||||||
|
|
||||||
|
RefreshCampaigns();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="window-wrapper" :id="'window-wrapper-' + id" ref="wrapper">
|
||||||
|
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
||||||
|
|
||||||
|
<div class="two-column">
|
||||||
|
<div class="vert-expand secondary">
|
||||||
|
<div class="image-container">
|
||||||
|
<img alt="Dragonroll logo" src="/img/logo-splash.png" draggable="false" width="100%">
|
||||||
|
</div>
|
||||||
|
<div class="patch-notes-container">
|
||||||
|
<h1>Welcome to dragonroll!</h1>
|
||||||
|
<h2>Version 0.1</h2>
|
||||||
|
<p>This is totally under construction. This is a review of how the patch notes will be displayed.</p>
|
||||||
|
<p>There is also a lot of heavy development here.</p>
|
||||||
|
</div>
|
||||||
|
<VersionRender></VersionRender>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="vert-expand" style="max-width: 450px;">
|
||||||
|
<EditUserPartial></EditUserPartial>
|
||||||
|
<!-- Body -->
|
||||||
|
<div class="vert-expand">
|
||||||
|
<div class="vert top">
|
||||||
|
<h1>{{ $t("main-menu.main-menu")}}</h1>
|
||||||
|
|
||||||
|
<!-- HERE -->
|
||||||
|
<div class="campaign-list">
|
||||||
|
<CampaignEntry v-for="camp in campaings" :key="camp._id" :data="camp"></CampaignEntry>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="vert bot">
|
||||||
|
<div class="button-container">
|
||||||
|
<button class="btn-primary button-expand sound-click" v-on:click="CreateCampaignWindow" ref="campaignButton">{{ $t("main-menu.create-campaign") }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
h1 {
|
||||||
|
margin-top: 20px;
|
||||||
|
font-family: MrEavesRemake;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2, h3 {
|
||||||
|
font-family: MrEavesRemake;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patch-notes-container {
|
||||||
|
margin: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.two-column {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary {
|
||||||
|
background-color: var(--color-background-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.expand {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.vert-expand {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-grow: 1;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.button-expand {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-container {
|
||||||
|
display: flex;
|
||||||
|
margin: 20px;
|
||||||
|
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.window-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.splash-image {
|
||||||
|
width: 600px;
|
||||||
|
height: 250px;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
136
frontend/app/components/windows/NewFolderWindow.vue
Normal file
136
frontend/app/components/windows/NewFolderWindow.vue
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||||
|
import { SetupHandle, SetSize, ResetPosition, ClearWindow } from '@/services/Windows';
|
||||||
|
import WindowHandle from './partials/WindowHandle.vue';
|
||||||
|
import Server from '~/services/Server';
|
||||||
|
import { emitter } from '~/services/Emitter';
|
||||||
|
|
||||||
|
const handle = ref(null);
|
||||||
|
const wrapper = ref(null);
|
||||||
|
|
||||||
|
const props = defineProps(['data']);
|
||||||
|
const data = props.data;
|
||||||
|
|
||||||
|
let id = data.id;
|
||||||
|
|
||||||
|
const newName = ref('');
|
||||||
|
const creating = !!data.name;
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
newName.value = data.name || '';
|
||||||
|
SetupHandle(id, handle);
|
||||||
|
SetSize(id, { width: 420, height: 200 });
|
||||||
|
ResetPosition(id, 'center');
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
ClearWindow({ type: 'new_folder' });
|
||||||
|
});
|
||||||
|
|
||||||
|
function confirmSave() {
|
||||||
|
if (!newName.value.trim()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const folderData = {
|
||||||
|
name: newName.value.trim(),
|
||||||
|
campaign: data.campaign
|
||||||
|
};
|
||||||
|
|
||||||
|
const url = creating ? '/folder/rename' : '/folder/create';
|
||||||
|
if (creating) {
|
||||||
|
folderData.id = data.folderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
Server().post(url, folderData).then((response) => {
|
||||||
|
if (response.data.status !== 'ok') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emitter.emit('folder-saved', response.data.folder);
|
||||||
|
ClearWindow({ id });
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="window-wrapper" :id="'window-wrapper-' + id" ref="wrapper">
|
||||||
|
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
||||||
|
|
||||||
|
<div class="body">
|
||||||
|
<h3>{{ creating ? 'Rename Folder' : 'New Folder' }}</h3>
|
||||||
|
<form v-on:submit.prevent="confirmSave">
|
||||||
|
<div class="form-field">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="newName"
|
||||||
|
placeholder="Folder name"
|
||||||
|
autofocus
|
||||||
|
autocomplete="off"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions">
|
||||||
|
<button class="btn-primary sound-click" type="submit">{{ creating ? 'Save' : 'Create' }}</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.window-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 10px 10px;
|
||||||
|
font-family: MrEavesRemake;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-field > * {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 8px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--color-background-soft);
|
||||||
|
color: var(--color-text);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions button {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 200px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,42 +1,232 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { SetupHandle, SetSize, ResetPosition } from '@/services/Windows';
|
import { SetupHandle, SetSize, ResetPosition, CreateWindow, ClearWindow, Top } from '@/services/Windows';
|
||||||
|
|
||||||
import WindowHandle from './partials/WindowHandle.vue';
|
import WindowHandle from './partials/WindowHandle.vue';
|
||||||
|
import Spinner from '../partials/Spinner.vue';
|
||||||
|
import { DisplayToast } from '~/services/Toaster';
|
||||||
|
import Server from '~/services/Server';
|
||||||
|
import { errorMessages } from 'vue/compiler-sfc';
|
||||||
|
|
||||||
const handle = ref(null);
|
const handle = ref(null);
|
||||||
|
const wrapper = ref(null);
|
||||||
|
|
||||||
const props = defineProps(['data']);
|
const props = defineProps(['data']);
|
||||||
const data = props.data;
|
const data = props.data;
|
||||||
|
|
||||||
let id = data.type;
|
let id = data.id;
|
||||||
|
|
||||||
const test = ref(null)
|
const username = ref("");
|
||||||
|
const password = ref("");
|
||||||
|
const passwordConfirm = ref("");
|
||||||
|
const email = ref("");
|
||||||
|
const name = ref("");
|
||||||
|
|
||||||
|
const firstTime = ref(false);
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
const images = [
|
||||||
|
"https://cdn.aranroig.com/art/miirym/miirym.jpg",
|
||||||
|
"https://cdn.aranroig.com/art/nozt/nozt.jpg",
|
||||||
|
"https://cdn.aranroig.com/art/knocking/knocking.jpg",
|
||||||
|
"https://cdn.aranroig.com/art/valentin/valentin.jpg",
|
||||||
|
]
|
||||||
|
|
||||||
|
const splashSource = ref("");
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
Top(wrapper);
|
||||||
SetupHandle(id, handle);
|
SetupHandle(id, handle);
|
||||||
SetSize(id, {width: 500, height: 380});
|
SetSize(id, {width: 500});
|
||||||
ResetPosition(id, "center");
|
ResetPosition(id, "center");
|
||||||
|
|
||||||
|
// Pick random image
|
||||||
|
const randomIndex = Math.floor(Math.random() * images.length);
|
||||||
|
splashSource.value = images[randomIndex];
|
||||||
|
firstTime.value = data.firstTime;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function toLogin(){
|
||||||
|
CreateWindow('login');
|
||||||
|
ClearWindow({type: 'register'});
|
||||||
|
}
|
||||||
|
|
||||||
|
function register(){
|
||||||
|
if(username.value.length < 3){
|
||||||
|
DisplayToast('red', $t('register.errors.username-empty'), 3000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(email.value.length < 5 || !email.value.includes('@')){
|
||||||
|
DisplayToast('red', $t('register.errors.email-empty'), 3000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(name.value.length == 0){
|
||||||
|
DisplayToast('red', $t('register.errors.name-empty'), 3000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(password.value !== passwordConfirm.value){
|
||||||
|
DisplayToast('red', $t('register.errors.passwords-no-match'), 3000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loading.value = true;
|
||||||
|
Server().post('/user/register', {
|
||||||
|
username: username.value,
|
||||||
|
email: email.value,
|
||||||
|
name: name.value,
|
||||||
|
password: password.value
|
||||||
|
}).then((response) => {
|
||||||
|
DisplayToast('green', $t('register.success'), 3000);
|
||||||
|
toLogin();
|
||||||
|
}).catch((error) => {
|
||||||
|
if(error.response && error.response.data && error.response.data.message){
|
||||||
|
DisplayToast('red', $t(register.error.response.data.message), 3000);
|
||||||
|
} else {
|
||||||
|
DisplayToast('red', $t("errors.internal"), 3000);
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="window-wrapper" :id="'window-wrapper-' + id">
|
<div class="window-wrapper" :id="'window-wrapper-' + id" ref="wrapper">
|
||||||
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
||||||
|
|
||||||
<!-- Body -->
|
<!-- Body -->
|
||||||
<div ref="test"></div>
|
<div class="vert-expand">
|
||||||
|
<div class="image-container">
|
||||||
|
<div class="image-crop">
|
||||||
|
<img :src="splashSource" class="main-image">
|
||||||
|
</div>
|
||||||
|
<picture class="overlay-image">
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="/img/logo-splash.png">
|
||||||
|
<source media="(prefers-color-scheme: light)" srcset="/img/logo-splash-light.png">
|
||||||
|
<img alt="Dragonroll logo" src="/img/logo-splash.png" draggable="false" width="250px">
|
||||||
|
</picture>
|
||||||
|
</div>
|
||||||
|
<form v-on:submit.prevent="register">
|
||||||
|
<p class="green" v-if="firstTime">{{ $t('register.first-register-message') }}</p>
|
||||||
|
<h2>{{ $t('register.welcome') }}</h2>
|
||||||
|
<p>{{ $t('register.message') }}</p>
|
||||||
|
<div class="form-field">
|
||||||
|
<label for="username">{{$t('register.username')}}</label>
|
||||||
|
<input id="username-field" type="text" :placeholder="$t('register.username-placeholder')" name="username" v-model="username" autocomplete="off" >
|
||||||
|
</div>
|
||||||
|
<div class="form-field">
|
||||||
|
<label for="email">{{$t('register.email')}}</label>
|
||||||
|
<input id="email-field" type="text" :placeholder="$t('register.email-placeholder')" name="email" v-model="email" autocomplete="off" >
|
||||||
|
</div>
|
||||||
|
<div class="form-field">
|
||||||
|
<label for="name">{{$t('register.name')}}</label>
|
||||||
|
<input id="name-field" type="text" :placeholder="$t('register.name-placeholder')" name="name" v-model="name" autocomplete="off" >
|
||||||
|
</div>
|
||||||
|
<div class="form-field">
|
||||||
|
<label for="password">{{$t('register.password')}}</label>
|
||||||
|
<div class="two-rows expand">
|
||||||
|
<input id="password-field" type="password" :placeholder="$t('register.password-placeholder')" name="password" v-model="password" autocomplete="off" >
|
||||||
|
<input id="password-field" type="password" :placeholder="$t('register.password-confirm-placeholder')" name="password" v-model="passwordConfirm" autocomplete="off" >
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-field">
|
||||||
|
<button class="btn-primary sound-click">
|
||||||
|
<span v-if="loading">
|
||||||
|
<Spinner />
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
{{$t('register.register')}}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="form-field center" v-if="!firstTime">
|
||||||
|
<p>{{$t('register.have-account')}} <a href="#" @click.prevent="toLogin">{{$t('register.login')}}</a></p>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
p {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expand {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.vert-expand {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.window-wrapper {
|
.window-wrapper {
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.splash-image {
|
||||||
|
width: 450px;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
margin-left: 30px;
|
||||||
|
margin-right: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-container {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-crop {
|
||||||
|
height: 200px; /* adjust as needed */
|
||||||
|
width: 500px; /* adjust as needed */
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-image {
|
||||||
|
position: absolute;
|
||||||
|
width: 500px; /* adjust as needed */
|
||||||
|
top: 0px; /* adjust as needed */
|
||||||
|
}
|
||||||
|
.overlay-image {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 250px; /* adjust as needed */
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
127
frontend/app/components/windows/RenameNoteWindow.vue
Normal file
127
frontend/app/components/windows/RenameNoteWindow.vue
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||||
|
import { SetupHandle, SetSize, ResetPosition, ClearWindow } from '@/services/Windows';
|
||||||
|
import WindowHandle from './partials/WindowHandle.vue';
|
||||||
|
import Server from '~/services/Server';
|
||||||
|
import { emitter } from '~/services/Emitter';
|
||||||
|
|
||||||
|
const handle = ref(null);
|
||||||
|
const wrapper = ref(null);
|
||||||
|
|
||||||
|
const props = defineProps(['data']);
|
||||||
|
const data = props.data;
|
||||||
|
|
||||||
|
let id = data.id;
|
||||||
|
|
||||||
|
const newName = ref('');
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
newName.value = data.title || '';
|
||||||
|
SetupHandle(id, handle);
|
||||||
|
SetSize(id, { width: 420, height: 200 });
|
||||||
|
ResetPosition(id, 'center');
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
ClearWindow({ type: 'rename_note' });
|
||||||
|
});
|
||||||
|
|
||||||
|
function confirmRename() {
|
||||||
|
if (!newName.value.trim()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Server().post('/note/update', {
|
||||||
|
id: data.key,
|
||||||
|
title: newName.value.trim(),
|
||||||
|
}).then((response) => {
|
||||||
|
if (response.data.status !== 'ok') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emitter.emit('note-renamed', { key: data.key, title: newName.value.trim() });
|
||||||
|
ClearWindow({ id });
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="window-wrapper" :id="'window-wrapper-' + id" ref="wrapper">
|
||||||
|
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
||||||
|
|
||||||
|
<div class="body">
|
||||||
|
<h3>Rename Note</h3>
|
||||||
|
<form v-on:submit.prevent="confirmRename">
|
||||||
|
<div class="form-field">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="newName"
|
||||||
|
placeholder="Note title"
|
||||||
|
autofocus
|
||||||
|
autocomplete="off"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions">
|
||||||
|
<button class="btn-primary sound-click" type="submit">Save</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.window-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 10px 10px;
|
||||||
|
font-family: MrEavesRemake;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-field > * {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 8px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--color-background-soft);
|
||||||
|
color: var(--color-text);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions button {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 200px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
136
frontend/app/components/windows/SettingsWindow.vue
Normal file
136
frontend/app/components/windows/SettingsWindow.vue
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
import WindowHandle from './partials/WindowHandle.vue';
|
||||||
|
import Tabs from '../layouts/Tabs.vue';
|
||||||
|
import Dropdown from '../layouts/Dropdown.vue';
|
||||||
|
import { GetUser, GetUserSetting, SetUserSetting } from '@/services/User';
|
||||||
|
import { SetupHandle, SetSize, ResetPosition, Top, ClearWindow, CreateWindow, SetMinSize, SetResizable } from '@/services/Windows';
|
||||||
|
import { locales } from '~~/i18n/locales';
|
||||||
|
|
||||||
|
const handle = ref(null);
|
||||||
|
const wrapper = ref(null);
|
||||||
|
|
||||||
|
const props = defineProps(['data']);
|
||||||
|
const data = props.data;
|
||||||
|
|
||||||
|
const { locale } = useI18n();
|
||||||
|
|
||||||
|
|
||||||
|
const changeLocale = (lang) => {
|
||||||
|
console.log(lang);
|
||||||
|
locale.value = lang.code;
|
||||||
|
SetUserSetting('lang', lang.code);
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = data.id;
|
||||||
|
|
||||||
|
const rows = ref([{id: "account-settings", value: "settings.tabs.account-settings"}]);
|
||||||
|
|
||||||
|
/* TODO
|
||||||
|
const languageOptions = ref(["English", "Spanish", "Catalan"])
|
||||||
|
const langSelector = ref(null);
|
||||||
|
*/
|
||||||
|
function getLocaleFromCode(code){
|
||||||
|
for(let i = 0; i < locales.length; i++){
|
||||||
|
if(locales[i].code == code) return locales[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedLocale = ref("");
|
||||||
|
onBeforeMount(() => {
|
||||||
|
GetUserSetting('lang').then(value => {
|
||||||
|
locale.value = value;
|
||||||
|
selectedLocale.value = getLocaleFromCode(value); // Set selected in dropdown
|
||||||
|
});
|
||||||
|
if(GetUser().admin) rows.value.push({
|
||||||
|
id: "site-administration",
|
||||||
|
value: "settings.tabs.site-administration"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
Top(wrapper);
|
||||||
|
SetupHandle(id, handle);
|
||||||
|
SetSize(id, {width: 600, height: 480});
|
||||||
|
ResetPosition(id, "center");
|
||||||
|
|
||||||
|
SetResizable(id, true);
|
||||||
|
SetMinSize(id, {width: 450, height: 280});
|
||||||
|
});
|
||||||
|
|
||||||
|
function OpenManageAccounts(){
|
||||||
|
ClearWindow('settings');
|
||||||
|
CreateWindow('account_management', {
|
||||||
|
type: 'account_management',
|
||||||
|
title: 'settings.site-administration.manage-accounts.title',
|
||||||
|
id: 'account-management',
|
||||||
|
back: () => {
|
||||||
|
ClearWindow('account-management')
|
||||||
|
CreateWindow('settings', {
|
||||||
|
id: 'settings',
|
||||||
|
type: 'settings',
|
||||||
|
title: 'settings.title',
|
||||||
|
back: () => { ClearWindow('settings'); CreateWindow('main_menu'); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const getLocaleName = (locale) => {
|
||||||
|
return locale.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="window-wrapper" :id="'window-wrapper-' + id" ref="wrapper">
|
||||||
|
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
||||||
|
|
||||||
|
<!-- Body -->
|
||||||
|
<Tabs :rows="rows">
|
||||||
|
<template #account-settings>
|
||||||
|
<div class="form-container">
|
||||||
|
<div class="form-element">
|
||||||
|
<label>{{ $t('settings.account-settings.language') }}</label>
|
||||||
|
<Dropdown :options="locales" :keyFunc="getLocaleName" :onselect="changeLocale" :selected="selectedLocale"></Dropdown>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #site-administration>
|
||||||
|
<div class="form-element centered">
|
||||||
|
<button v-on:click.prevent="OpenManageAccounts">{{ $t('settings.site-administration.manage-accounts') }}</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Tabs>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.window-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.splash-image {
|
||||||
|
width: 600px;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-field {
|
||||||
|
padding: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: left;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: left;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
31
frontend/app/components/windows/partials/BigIconTemplate.vue
Normal file
31
frontend/app/components/windows/partials/BigIconTemplate.vue
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted, ref, watch } from 'vue';
|
||||||
|
const props = defineProps(['title', 'img']);
|
||||||
|
|
||||||
|
const imgSrc = ref("");
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
imgSrc.value = props.img;
|
||||||
|
watch(() => props.img, () => {
|
||||||
|
imgSrc.value = props.img;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="document centered">
|
||||||
|
<h1>{{props.title}}</h1>
|
||||||
|
<img :src="imgSrc" class="big-icon">
|
||||||
|
<br>
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.big-icon {
|
||||||
|
height: 80px;
|
||||||
|
width: 80px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
margin:auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<script setup>
|
||||||
|
import IconButton from '~/components/layouts/IconButton.vue';
|
||||||
|
|
||||||
|
const props = defineProps(['plus', 'edit', 'view', 'remove']);
|
||||||
|
|
||||||
|
let plus = props.plus;
|
||||||
|
let edit = props.edit;
|
||||||
|
let view = props.view;
|
||||||
|
let remove = props.remove;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="fixed-bottom-buttons">
|
||||||
|
<IconButton v-show="plus" icon="/icons/iconoir/regular/plus.svg" :action="plus"></IconButton>
|
||||||
|
<IconButton v-show="edit" icon="/icons/iconoir/regular/edit-pencil.svg" :action="edit"></IconButton>
|
||||||
|
<IconButton v-show="view" icon="/icons/iconoir/solid/eye.svg" :action="view"></IconButton>
|
||||||
|
<IconButton v-show="remove" icon="/icons/iconoir/solid/trash.svg" :action="remove"></IconButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.fixed-bottom-buttons {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
right: 10px;
|
||||||
|
z-index: 2;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, watch } from 'vue';
|
import { onMounted, ref, watch } from 'vue';
|
||||||
import { GetWindowWithId, ClearWindow, Windows } from '@/services/Windows';
|
import { GetWindowWithId } from '@/services/Windows';
|
||||||
|
|
||||||
import ArrowLeftIcon from '/icons/iconoir/regular/arrow-left.svg';
|
import ArrowLeftIcon from '/icons/iconoir/regular/arrow-left.svg';
|
||||||
import XMarkIcon from '/icons/iconoir/regular/xmark.svg';
|
import XMarkIcon from '/icons/iconoir/regular/xmark.svg';
|
||||||
@@ -74,13 +74,13 @@ defineExpose({
|
|||||||
<div class="window-handle" :id="'window-handle-' + id">
|
<div class="window-handle" :id="'window-handle-' + id">
|
||||||
|
|
||||||
<div class="left" v-if="def">
|
<div class="left" v-if="def">
|
||||||
<img class="icon icon-add-margin" :src="ArrowLeftIcon" draggable="false" ref="backButton" v-if="hasBack" v-on:click="backFunction">
|
<img class="icon-handle icon-add-margin" :src="ArrowLeftIcon" draggable="false" ref="backButton" v-if="hasBack" v-on:click="backFunction">
|
||||||
</div>
|
</div>
|
||||||
<div class="center" v-if="def">
|
<div class="center" v-if="def">
|
||||||
<span>{{ title }}</span>
|
<span>{{ title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<img class="icon" :src="XMarkIcon" draggable="false" ref="closeButton" v-if="close" v-on:click="CloseButton">
|
<img class="icon-handle" :src="XMarkIcon" draggable="false" ref="closeButton" v-if="close" v-on:click="CloseButton">
|
||||||
</div>
|
</div>
|
||||||
<!-- span>{{ title }}</span>
|
<!-- span>{{ title }}</span>
|
||||||
|
|
||||||
@@ -126,6 +126,11 @@ defineExpose({
|
|||||||
justify-content: right;
|
justify-content: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
font-family: MrEavesRemake;
|
font-family: MrEavesRemake;
|
||||||
}
|
}
|
||||||
@@ -139,4 +144,10 @@ defineExpose({
|
|||||||
background-color: var(--color-window-handle-background);
|
background-color: var(--color-window-handle-background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-handle {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
filter: invert(var(--color-icon-invert));
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
6
frontend/app/plugins/api.ts
Normal file
6
frontend/app/plugins/api.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { initApi } from '../services/Server';
|
||||||
|
|
||||||
|
export default defineNuxtPlugin(() => {
|
||||||
|
const config = useRuntimeConfig();
|
||||||
|
initApi(config.public.apiBaseUrl);
|
||||||
|
});
|
||||||
31
frontend/app/plugins/i18n.ts
Normal file
31
frontend/app/plugins/i18n.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { createI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
function loadLocaleMessages() {
|
||||||
|
const locales = import.meta.glob('../../i18n/locales/**/*.json', { eager: true })
|
||||||
|
const messages: Record<string, any> = {}
|
||||||
|
|
||||||
|
for (const path in locales) {
|
||||||
|
const matched = path.match(/i18n\/locales\/(\w+)\/(.*)\.json$/)
|
||||||
|
if (!matched) continue
|
||||||
|
|
||||||
|
const [, locale, file] = matched
|
||||||
|
|
||||||
|
if (!messages[locale]) {
|
||||||
|
messages[locale] = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
messages[locale][file] = (locales[path] as any).default
|
||||||
|
}
|
||||||
|
|
||||||
|
return messages
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
|
const i18n = createI18n({
|
||||||
|
legacy: false,
|
||||||
|
locale: 'en',
|
||||||
|
messages: loadLocaleMessages()
|
||||||
|
})
|
||||||
|
|
||||||
|
nuxtApp.vueApp.use(i18n)
|
||||||
|
})
|
||||||
54
frontend/app/services/ActionRegistry.js
Normal file
54
frontend/app/services/ActionRegistry.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
const actions = ref([]);
|
||||||
|
|
||||||
|
function register(action) {
|
||||||
|
if (!action.id || !action.execute) {
|
||||||
|
console.warn('[ActionRegistry] Action missing id or execute:', action);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const existingIndex = actions.value.findIndex(a => a.id === action.id);
|
||||||
|
if (existingIndex !== -1) {
|
||||||
|
actions.value[existingIndex] = action;
|
||||||
|
} else {
|
||||||
|
actions.value.push(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function unregister(id) {
|
||||||
|
actions.value = actions.value.filter(a => a.id !== id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function search(query) {
|
||||||
|
if (!query || query.trim() === '') return [];
|
||||||
|
|
||||||
|
const q = query.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim();
|
||||||
|
if (q === '') return [];
|
||||||
|
|
||||||
|
return actions.value.filter(action => {
|
||||||
|
if (typeof action.isActive === 'function' && !action.isActive()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const label = (action.label || '').normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
||||||
|
const description = (action.description || '').normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
||||||
|
return label.includes(q) || description.includes(q);
|
||||||
|
}).sort((a, b) => {
|
||||||
|
const aLabel = (a.label || '').toLowerCase();
|
||||||
|
const bLabel = (b.label || '').toLowerCase();
|
||||||
|
const qLower = q;
|
||||||
|
const aStarts = aLabel.startsWith(qLower) ? 0 : 1;
|
||||||
|
const bStarts = bLabel.startsWith(qLower) ? 0 : 1;
|
||||||
|
return aStarts - bStarts || aLabel.localeCompare(bLabel);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function execute(id, params = {}) {
|
||||||
|
const action = actions.value.find(a => a.id === id);
|
||||||
|
if (action && action.execute) {
|
||||||
|
action.execute(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { register, unregister, search, execute };
|
||||||
|
export default { register, unregister, search, execute };
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
var backendUrl = ''
|
|
||||||
if (import.meta.env.PROD) {
|
|
||||||
backendUrl = 'https://api.aranroig.com/';
|
|
||||||
} else {
|
|
||||||
backendUrl = 'http://localhost:5000/'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
|
||||||
backendUrl
|
|
||||||
};
|
|
||||||
41
frontend/app/services/Campaign.js
Normal file
41
frontend/app/services/Campaign.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import Server from './Server';
|
||||||
|
|
||||||
|
const SELECTED_CAMPAIGN_KEY = 'selectedCampaignId';
|
||||||
|
|
||||||
|
export const useCampaignService = () => {
|
||||||
|
const Campaign = useState('campaign', () => null)
|
||||||
|
|
||||||
|
const SetCampaign = (data) => {
|
||||||
|
Campaign.value = data;
|
||||||
|
if (data?._id) {
|
||||||
|
localStorage.setItem(SELECTED_CAMPAIGN_KEY, data._id);
|
||||||
|
} else {
|
||||||
|
localStorage.removeItem(SELECTED_CAMPAIGN_KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const RestoreCampaign = async () => {
|
||||||
|
const campaignId = localStorage.getItem(SELECTED_CAMPAIGN_KEY);
|
||||||
|
if (!campaignId) return false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await Server().get(`/campaign/retrieve/${campaignId}`);
|
||||||
|
if (response.data.status !== 'ok') {
|
||||||
|
SetCampaign(null);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCampaign(response.data.campaign);
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
SetCampaign(null);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
Campaign,
|
||||||
|
SetCampaign,
|
||||||
|
RestoreCampaign
|
||||||
|
}
|
||||||
|
}
|
||||||
156
frontend/app/services/ContextMenu.js
Normal file
156
frontend/app/services/ContextMenu.js
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
// You should hide the context menu when the element that has the
|
||||||
|
// event gets removed
|
||||||
|
|
||||||
|
let margin = -3;
|
||||||
|
|
||||||
|
let cursorX = 0;
|
||||||
|
let cursorY = 0;
|
||||||
|
|
||||||
|
let arrowIcon = "icons/iconoir/regular/nav-arrow-right.svg";
|
||||||
|
|
||||||
|
import { animate } from 'motion'
|
||||||
|
|
||||||
|
function Show(){
|
||||||
|
let contextMenu = document.getElementById('context-menu');
|
||||||
|
contextMenu.style.display = "flex";
|
||||||
|
contextMenu.style.top = (cursorY + margin) + "px";
|
||||||
|
contextMenu.style.left = (cursorX + margin) + "px";
|
||||||
|
}
|
||||||
|
|
||||||
|
function HideContextMenu(){
|
||||||
|
let contextMenu = document.getElementById('context-menu');
|
||||||
|
contextMenu.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
function PopulateContext(val){
|
||||||
|
let children = [];
|
||||||
|
|
||||||
|
let elementNum = 0;
|
||||||
|
val.forEach(element => {
|
||||||
|
// Handle divider elements
|
||||||
|
if (element.divider) {
|
||||||
|
let contextMenuElement = document.createElement('div');
|
||||||
|
contextMenuElement.classList.add("context-menu-divider");
|
||||||
|
children.push(contextMenuElement);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let contextMenuElement = document.createElement('div');
|
||||||
|
contextMenuElement.classList.add("context-menu-element");
|
||||||
|
if(element.action)
|
||||||
|
contextMenuElement.addEventListener("click", element.action);
|
||||||
|
|
||||||
|
let spanInfo = document.createElement('span');
|
||||||
|
spanInfo.innerHTML = element.name;
|
||||||
|
contextMenuElement.appendChild(spanInfo);
|
||||||
|
|
||||||
|
if(element.icon){
|
||||||
|
let iconContextElement = document.createElement('img');
|
||||||
|
iconContextElement.src = element.icon;
|
||||||
|
contextMenuElement.appendChild(iconContextElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(element.context){
|
||||||
|
let iconContextElement = document.createElement('img');
|
||||||
|
iconContextElement.src = arrowIcon;
|
||||||
|
contextMenuElement.appendChild(iconContextElement);
|
||||||
|
|
||||||
|
let childContextMenuElement = document.createElement('div');
|
||||||
|
childContextMenuElement.classList.add("context-menu");
|
||||||
|
childContextMenuElement.style.left = "100%";
|
||||||
|
childContextMenuElement.style.top = "0";
|
||||||
|
childContextMenuElement.style.display = "none";
|
||||||
|
|
||||||
|
let childChildren = PopulateContext(element.context);
|
||||||
|
childChildren.forEach((child) => childContextMenuElement.appendChild(child));
|
||||||
|
|
||||||
|
contextMenuElement.addEventListener("mouseenter", () => {
|
||||||
|
childContextMenuElement.style.display = "flex";
|
||||||
|
});
|
||||||
|
|
||||||
|
contextMenuElement.addEventListener("mouseleave", () => {
|
||||||
|
childContextMenuElement.style.display = "none";
|
||||||
|
})
|
||||||
|
|
||||||
|
contextMenuElement.appendChild(childContextMenuElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
children.push(contextMenuElement);
|
||||||
|
|
||||||
|
animate(contextMenuElement, {
|
||||||
|
opacity: [0, 1],
|
||||||
|
translateY: [-20, -2]
|
||||||
|
}, {duration: 0.15}).finished.then(() => {
|
||||||
|
|
||||||
|
});
|
||||||
|
elementNum++;
|
||||||
|
});
|
||||||
|
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
function PopulateContextMenu(val){
|
||||||
|
let contextMenu = document.getElementById('context-menu');
|
||||||
|
let children = PopulateContext(val);
|
||||||
|
|
||||||
|
contextMenu.replaceChildren();
|
||||||
|
children.forEach((el) => contextMenu.appendChild(el));
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddContextMenu(element, val, options = {}){
|
||||||
|
element._dr_context = val;
|
||||||
|
|
||||||
|
function show(e){
|
||||||
|
e.preventDefault();
|
||||||
|
PopulateContextMenu(val);
|
||||||
|
Show();
|
||||||
|
if(options.dropdown){
|
||||||
|
let rect = element.getBoundingClientRect();
|
||||||
|
let contextMenu = document.getElementById('context-menu');
|
||||||
|
contextMenu.style.top = rect.bottom + "px";
|
||||||
|
contextMenu.style.left = rect.left + "px";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener('contextmenu', show);
|
||||||
|
if(options.dropdown) element.addEventListener('click', show);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function UpdateVisibility(){
|
||||||
|
let contextMenu = document.getElementById('context-menu');
|
||||||
|
let element = document.elementFromPoint(cursorX, cursorY);
|
||||||
|
let mustHide = true;
|
||||||
|
while(element){
|
||||||
|
if(element == contextMenu){
|
||||||
|
mustHide = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
element = element.parentElement;
|
||||||
|
}
|
||||||
|
if(mustHide) HideContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetupContextMenu(){
|
||||||
|
HideContextMenu();
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', (e) => {
|
||||||
|
cursorX = e.clientX;
|
||||||
|
cursorY = e.clientY;
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('mousedown', UpdateVisibility);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShowContextMenu(val){
|
||||||
|
PopulateContextMenu(val);
|
||||||
|
Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
SetupContextMenu,
|
||||||
|
AddContextMenu,
|
||||||
|
ShowContextMenu,
|
||||||
|
HideContextMenu
|
||||||
|
};
|
||||||
109
frontend/app/services/Marker.js
Normal file
109
frontend/app/services/Marker.js
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
import { Marked } from "marked";
|
||||||
|
const widget_map = {
|
||||||
|
inline: {
|
||||||
|
roll: () => import("~/components/viewer/widgets/inline/RollWidgetInline.vue"),
|
||||||
|
},
|
||||||
|
display: {
|
||||||
|
roll: () => import("~/components/viewer/widgets/display/RollWidgetDisplay.vue"),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const componentCache = {
|
||||||
|
inline: {},
|
||||||
|
display: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
const GetWidget = (type, name) => {
|
||||||
|
if (!componentCache[type][name]) {
|
||||||
|
componentCache[type][name] = defineAsyncComponent(
|
||||||
|
widget_map[type][name]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return componentCache[type][name]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const marker = new Marked();
|
||||||
|
|
||||||
|
const extension = {
|
||||||
|
name: "widget",
|
||||||
|
level: "block",
|
||||||
|
|
||||||
|
tokenizer(src) {
|
||||||
|
const rule = /^@(\w+)\n([\s\S]+?)\n@end/;
|
||||||
|
const match = rule.exec(src);
|
||||||
|
|
||||||
|
if (!match) return;
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: "widget",
|
||||||
|
raw: match[0],
|
||||||
|
name: match[1],
|
||||||
|
text: match[2],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
renderer(token) {
|
||||||
|
return `<div class="vue-component-display" data-component="${token.name}" data-content="${token.text}"></div>`;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const inlineExtension = {
|
||||||
|
name: "widget_inline",
|
||||||
|
level: "inline",
|
||||||
|
start(src) {
|
||||||
|
return src.indexOf("@");
|
||||||
|
},
|
||||||
|
|
||||||
|
tokenizer(src) {
|
||||||
|
const rule = /^@(\w+)\s*\[([^\]]*)\]/;
|
||||||
|
const match = rule.exec(src);
|
||||||
|
if (!match) return;
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: "widget_inline",
|
||||||
|
raw: match[0],
|
||||||
|
name: match[1],
|
||||||
|
text: match[2],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
renderer(token) {
|
||||||
|
return `<span class="vue-component-inline" data-component="${token.name}" data-content="${token.text}"></span>`;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const linkExtension = {
|
||||||
|
name: "link_to",
|
||||||
|
level: "inline",
|
||||||
|
start(src) {
|
||||||
|
return src.indexOf("[[");
|
||||||
|
},
|
||||||
|
|
||||||
|
tokenizer(src) {
|
||||||
|
const rule = /^\[\[([^\n]*)\]\]/;
|
||||||
|
const match = rule.exec(src);
|
||||||
|
if (!match) return;
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: "link_to",
|
||||||
|
raw: match[0],
|
||||||
|
link: match[1],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
renderer(token) {
|
||||||
|
return `<span class="vue-link" data-href="${token.link}">Link</span>`;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
marker.use({
|
||||||
|
extensions: [extension, inlineExtension, linkExtension],
|
||||||
|
});
|
||||||
|
|
||||||
|
function ParseMarkdown(source) {
|
||||||
|
return marker.parse(source || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
export { ParseMarkdown, GetWidget };
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import { backendUrl } from './BackendURL';
|
|
||||||
|
|
||||||
const server = axios.create({
|
const server = axios.create({
|
||||||
baseURL: backendUrl,
|
baseURL: 'http://localhost:5000/api', // fallback only
|
||||||
headers: {
|
headers: {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Attach token dynamically on each request via interceptor
|
export const initApi = (baseURL) => {
|
||||||
|
server.defaults.baseURL = baseURL;
|
||||||
|
};
|
||||||
|
|
||||||
server.interceptors.request.use((config) => {
|
server.interceptors.request.use((config) => {
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('token');
|
||||||
if (token) {
|
if (token) {
|
||||||
@@ -19,3 +20,5 @@ server.interceptors.request.use((config) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default () => server;
|
export default () => server;
|
||||||
|
|
||||||
|
export const getBaseUrl = () => server.defaults.baseURL;
|
||||||
87
frontend/app/services/Tooltip.js
Normal file
87
frontend/app/services/Tooltip.js
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import { ref } from 'vue';
|
||||||
|
import { animate } from 'motion';
|
||||||
|
|
||||||
|
let content = ref("");
|
||||||
|
let margin = 14;
|
||||||
|
|
||||||
|
let cursorX = 0;
|
||||||
|
let cursorY = 0;
|
||||||
|
|
||||||
|
let showed = false;
|
||||||
|
let hided = false;
|
||||||
|
|
||||||
|
function ShowTooltip(){
|
||||||
|
let tooltip = document.getElementById('mouse-tooltip');
|
||||||
|
|
||||||
|
tooltip.style.display = "block";
|
||||||
|
|
||||||
|
if(!showed){
|
||||||
|
animate(tooltip, {
|
||||||
|
opacity: [0, 1],
|
||||||
|
translateY: [20, 0]
|
||||||
|
}, {duration: 0.1, ease: 'ease-out'});
|
||||||
|
showed = true;
|
||||||
|
hided = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function HideTooltip(){
|
||||||
|
let tooltip = document.getElementById('mouse-tooltip');
|
||||||
|
|
||||||
|
|
||||||
|
if(!hided){
|
||||||
|
animate(tooltip, {
|
||||||
|
opacity: [1, 0],
|
||||||
|
translateY: [0, 20]
|
||||||
|
}, {duration: 0.1, ease: 'ease-in'}).finished.then(() => tooltip.style.display = "none")
|
||||||
|
hided = true;
|
||||||
|
showed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddTooltip(element, val, data = {}){
|
||||||
|
element._dr_tooltip = {value: val, ...data};
|
||||||
|
}
|
||||||
|
|
||||||
|
function UpdateVisibilityThread(){
|
||||||
|
let tooltip = document.getElementById('mouse-tooltip');
|
||||||
|
let elements = document.elementsFromPoint(cursorX, cursorY);
|
||||||
|
|
||||||
|
let visible = false;
|
||||||
|
for(let i = 0; i < elements.length; i++){
|
||||||
|
let element = elements[i];
|
||||||
|
if(element._dr_tooltip){
|
||||||
|
ShowTooltip();
|
||||||
|
content.value = element._dr_tooltip.value;
|
||||||
|
if(element._dr_tooltip.max_width) tooltip.style.maxWidth = element._dr_tooltip.max_width + "px";
|
||||||
|
else tooltip.style.maxWidth = "none";
|
||||||
|
visible = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!visible) HideTooltip();
|
||||||
|
|
||||||
|
setTimeout(UpdateVisibilityThread, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetupTooltip(){
|
||||||
|
let tooltip = document.getElementById('mouse-tooltip');
|
||||||
|
|
||||||
|
document.addEventListener("mousemove", (event) => {
|
||||||
|
cursorX = event.clientX;
|
||||||
|
cursorY = event.clientY;
|
||||||
|
|
||||||
|
tooltip.style.top = (cursorY + margin) + "px";
|
||||||
|
tooltip.style.left = (cursorX + margin) + "px";
|
||||||
|
});
|
||||||
|
|
||||||
|
UpdateVisibilityThread();
|
||||||
|
}
|
||||||
|
|
||||||
|
let GetContentRef = () => content;
|
||||||
|
|
||||||
|
export {
|
||||||
|
SetupTooltip,
|
||||||
|
GetContentRef,
|
||||||
|
AddTooltip,
|
||||||
|
};
|
||||||
@@ -64,6 +64,7 @@ function LoadUser(){
|
|||||||
|
|
||||||
function LogoutUser(){
|
function LogoutUser(){
|
||||||
localStorage.removeItem("token");
|
localStorage.removeItem("token");
|
||||||
|
localStorage.removeItem("selectedCampaignId");
|
||||||
UserStatus.value = 0;
|
UserStatus.value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,51 @@
|
|||||||
|
import { ClearWindow, GetFirstWindowId } from './Windows'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Put here all dragonroll windows
|
Put here all dragonroll windows
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const defWindows = {
|
const defWindows = {
|
||||||
|
example: {
|
||||||
|
title: 'windows.example',
|
||||||
|
component: () => import('~/components/windows/ExampleWindow.vue'),
|
||||||
|
},
|
||||||
login: {
|
login: {
|
||||||
title: 'Login',
|
title: 'windows.login',
|
||||||
movable: false,
|
movable: false,
|
||||||
component: () => import('~/components/windows/LoginWindow.vue'),
|
component: () => import('~/components/windows/LoginWindow.vue'),
|
||||||
},
|
},
|
||||||
register: {
|
register: {
|
||||||
title: 'Register',
|
title: 'windows.register',
|
||||||
movable: false,
|
movable: false,
|
||||||
component: () => import('~/components/windows/RegisterWindow.vue'),
|
component: () => import('~/components/windows/RegisterWindow.vue'),
|
||||||
},
|
},
|
||||||
example: {
|
main_menu: {
|
||||||
title: 'Example',
|
title: 'windows.main-menu',
|
||||||
component: () => import('~/components/windows/ExampleWindow.vue'),
|
component: () => import('~/components/windows/MainMenuWindow.vue'),
|
||||||
|
movable: true
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
title: "windows.settings",
|
||||||
|
component: () => import('~/components/windows/SettingsWindow.vue'),
|
||||||
|
close: () => ClearWindow({type: 'settings'}),
|
||||||
|
movable: true
|
||||||
|
},
|
||||||
|
create_campaign: {
|
||||||
|
title: "windows.create-campaign",
|
||||||
|
component: () => import('~/components/windows/CreateCampaignWindow.vue'),
|
||||||
|
close: () => ClearWindow({type: 'create_campaign'}),
|
||||||
|
movable: true
|
||||||
|
},
|
||||||
|
rename_note: {
|
||||||
|
title: "Rename Note",
|
||||||
|
component: () => import('~/components/windows/RenameNoteWindow.vue'),
|
||||||
|
close: () => ClearWindow({type: 'rename_note'}),
|
||||||
|
movable: true
|
||||||
|
},
|
||||||
|
new_folder: {
|
||||||
|
title: "New Folder",
|
||||||
|
component: () => import('~/components/windows/NewFolderWindow.vue'),
|
||||||
|
close: () => ClearWindow({type: 'new_folder'}),
|
||||||
|
movable: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { defWindows } from './WindowDefinitions';
|
import { defWindows } from './WindowDefinitions';
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
|
|
||||||
|
const componentCache = {}
|
||||||
|
|
||||||
|
const getComponent = (type) => {
|
||||||
|
if (!componentCache[type]) {
|
||||||
|
componentCache[type] = defineAsyncComponent(
|
||||||
|
defWindows[type].component
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return componentCache[type]
|
||||||
|
}
|
||||||
|
|
||||||
const windows = ref([]);
|
const windows = ref([]);
|
||||||
|
|
||||||
const getComponent = (type) => defineAsyncComponent(defWindows[type]?.component)
|
|
||||||
|
|
||||||
const reload = ref(0);
|
|
||||||
|
|
||||||
let ReloadRef = () => { return reload };
|
|
||||||
let Windows = () => { return windows };
|
|
||||||
let WindowMap = () => { return windowMap };
|
let WindowMap = () => { return windowMap };
|
||||||
|
|
||||||
let currentIndex = 10;
|
let currentIndex = 10;
|
||||||
@@ -17,7 +23,6 @@ let currentId = 0;
|
|||||||
function SetupHandle(id, handle) {
|
function SetupHandle(id, handle) {
|
||||||
|
|
||||||
// Update window info with handle info
|
// Update window info with handle info
|
||||||
console.log(id);
|
|
||||||
let win = GetWindowWithId(id);
|
let win = GetWindowWithId(id);
|
||||||
|
|
||||||
let currentWindowId = "window-wrapper-" + id;
|
let currentWindowId = "window-wrapper-" + id;
|
||||||
@@ -107,8 +112,9 @@ function SetupHandle(id, handle) {
|
|||||||
|
|
||||||
// Should move eventually?
|
// Should move eventually?
|
||||||
window.addEventListener('resize', (event) => {
|
window.addEventListener('resize', (event) => {
|
||||||
if(!win.movable){
|
for(const w of windows.value){
|
||||||
ResetPosition(id, "center");
|
if(w.movable) continue;
|
||||||
|
ResetPosition(w.id, "center");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -183,6 +189,7 @@ function GetPosition(id) {
|
|||||||
|
|
||||||
function ResetPosition(id, pos) {
|
function ResetPosition(id, pos) {
|
||||||
let win = GetWindowWithId(id);
|
let win = GetWindowWithId(id);
|
||||||
|
if (!win) return;
|
||||||
let data = { x: win.x, y: win.y };
|
let data = { x: win.x, y: win.y };
|
||||||
|
|
||||||
if (data.x && data.y) {
|
if (data.x && data.y) {
|
||||||
@@ -194,70 +201,73 @@ function ResetPosition(id, pos) {
|
|||||||
|
|
||||||
|
|
||||||
function CreateWindow(type, data = {}) {
|
function CreateWindow(type, data = {}) {
|
||||||
|
|
||||||
let finalData = { ...{ type, id: currentId }, ...defWindows[type], ...data }
|
let finalData = { ...{ type, id: currentId }, ...defWindows[type], ...data }
|
||||||
console.log(finalData);
|
currentId++;
|
||||||
|
|
||||||
let contains = false;
|
let contains = false;
|
||||||
for (let i = 0; i < windows.value.length; i++) {
|
for (let i = 0; i < windows.value.length; i++) {
|
||||||
if (windows.value[i].type == finalData.type) {
|
if (windows.value[i].type == finalData.type) {
|
||||||
contains = true;
|
contains = true;
|
||||||
console.log("It contains")
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!contains) {
|
if (!contains) {
|
||||||
windows.value.push(finalData);
|
windows.value.push(finalData);
|
||||||
currentId++;
|
|
||||||
console.log(finalData);
|
|
||||||
console.log("Pushed ", finalData.type);
|
|
||||||
// reload.value += 1;
|
|
||||||
|
|
||||||
console.log(windows.value);
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
SetOnTop(finalData.type);
|
|
||||||
if (finalData.create) finalData.create();
|
if (finalData.create) finalData.create();
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateChildWindow(parentId, type, data = {}) {
|
function CreateChildWindow(parentId, type, data = {}) {
|
||||||
let finalData = { ...{ type }, ...defWindows[type], ...data }
|
const newId = currentId;
|
||||||
|
|
||||||
let parent = GetWindowWithId(parentId);
|
let parent = GetWindowWithId(parentId);
|
||||||
if (parent.children) parent.children.push(finalData.type);
|
if (parent.children) parent.children.push(newId); // We will create the child window right now
|
||||||
else parent.children = [finalData.type];
|
else parent.children = [newId];
|
||||||
CreateWindow(type, data);
|
CreateWindow(type, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GetFirstWindowId(type) {
|
||||||
|
for (let i = 0; i < windows.value.length; i++) {
|
||||||
|
if (windows.value[i].type == type) return windows.value[i].id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function ClearAll() {
|
function ClearAll() {
|
||||||
Object.keys(windows).forEach((key) => {
|
Object.keys(windows).forEach((key) => {
|
||||||
windows.value = [];
|
windows.value = [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function ClearWindows(data) {
|
function clearWindowById(id){
|
||||||
for (let i = 0; i < windows.value.length; i++) {
|
let win = GetWindowWithId(id);
|
||||||
ClearWindow(windows.value[i].type);
|
if (!win) return;
|
||||||
}
|
if (win.children) for (let i = 0; i < win.children.length; i++) clearWindowById(win.children[i]);
|
||||||
// reload.value += 1;
|
const index = windows.value.findIndex(w => w.id === id)
|
||||||
|
if (index !== -1) windows.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ClearWindow(selector) {
|
||||||
|
if(selector.type !== undefined) {
|
||||||
|
const type = selector.type;
|
||||||
|
for(let i = 0; i < windows.value.length; i++) {
|
||||||
|
if(windows.value[i].type == type) {
|
||||||
|
clearWindowById(windows.value[i].id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(selector.id !== undefined) {
|
||||||
|
const id = selector.id;
|
||||||
|
clearWindowById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ClearWindow(id) {
|
|
||||||
let win = GetWindowWithId(id);
|
|
||||||
console.log(win);
|
|
||||||
if (!win) return;
|
|
||||||
if (win.children) for (let i = 0; i < win.children.length; i++) ClearWindow(win.children[i]);
|
|
||||||
windows.value = windows.value.filter((e) => { return e.type !== id });
|
|
||||||
// reload.value += 1;
|
// reload.value += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetWindowWithId(id) {
|
function GetWindowWithId(id) {
|
||||||
for (let i = 0; i < windows.value.length; i++) {
|
const index = windows.value.findIndex(w => w.id === id);
|
||||||
if (windows.value[i].type == id) {
|
if (index !== -1) return windows.value[index];
|
||||||
return windows.value[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CallWindow(id, callableName, arg) {
|
function CallWindow(id, callableName, arg) {
|
||||||
@@ -282,7 +292,15 @@ function SetOnTop(id) {
|
|||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Top(element) {
|
||||||
|
try {
|
||||||
|
currentIndex += 1;
|
||||||
|
element.value.style.zIndex = currentIndex;
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
windows,
|
||||||
SetupHandle,
|
SetupHandle,
|
||||||
SetSize,
|
SetSize,
|
||||||
SetResizable,
|
SetResizable,
|
||||||
@@ -291,17 +309,16 @@ export {
|
|||||||
SetPosition,
|
SetPosition,
|
||||||
SetMovable,
|
SetMovable,
|
||||||
ResetPosition,
|
ResetPosition,
|
||||||
Windows,
|
|
||||||
WindowMap,
|
WindowMap,
|
||||||
ReloadRef,
|
|
||||||
ClearWindows,
|
|
||||||
CreateWindow,
|
CreateWindow,
|
||||||
CreateChildWindow,
|
CreateChildWindow,
|
||||||
|
GetFirstWindowId,
|
||||||
CallWindow,
|
CallWindow,
|
||||||
GetWindowWithId,
|
GetWindowWithId,
|
||||||
SaveWindowPos,
|
SaveWindowPos,
|
||||||
GetPosition,
|
GetPosition,
|
||||||
ClearWindow,
|
ClearWindow,
|
||||||
ClearAll,
|
ClearAll,
|
||||||
|
Top,
|
||||||
getComponent
|
getComponent
|
||||||
}
|
}
|
||||||
134
frontend/app/services/widgets/DiceParser.js
Normal file
134
frontend/app/services/widgets/DiceParser.js
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
// DiceParser.js
|
||||||
|
|
||||||
|
function roll(sides) {
|
||||||
|
return Math.floor(Math.random() * sides) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenize(expr) {
|
||||||
|
const re = /(\d*d\d+(?:adv|dis|kh\d+|kl\d+)?|\d+|[+\-*\/()])/gi;
|
||||||
|
const tokens = [];
|
||||||
|
let m;
|
||||||
|
while ((m = re.exec(expr)) !== null) tokens.push(m[0].toLowerCase());
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseDiceToken(tok) {
|
||||||
|
const m = tok.match(/^(\d*)d(\d+)(adv|dis|kh(\d+)|kl(\d+))?$/i);
|
||||||
|
if (!m) return null;
|
||||||
|
const count = parseInt(m[1] || '1');
|
||||||
|
const sides = parseInt(m[2]);
|
||||||
|
const mod = (m[3] || '').toLowerCase();
|
||||||
|
if (count < 1 || count > 1000 || sides < 2 || sides > 10000)
|
||||||
|
throw new Error(`Invalid dice: ${tok}`);
|
||||||
|
return { count, sides, mod };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parse(expr) {
|
||||||
|
const tokens = tokenize(expr);
|
||||||
|
if (!tokens.length) throw new Error('Empty expression');
|
||||||
|
let pos = 0;
|
||||||
|
|
||||||
|
const peek = () => tokens[pos];
|
||||||
|
const consume = () => tokens[pos++];
|
||||||
|
|
||||||
|
function parseExpr() { return parseAddSub(); }
|
||||||
|
|
||||||
|
function parseAddSub() {
|
||||||
|
let left = parseMulDiv();
|
||||||
|
while (peek() === '+' || peek() === '-') {
|
||||||
|
const op = consume();
|
||||||
|
const right = parseMulDiv();
|
||||||
|
left = {
|
||||||
|
value: op === '+' ? left.value + right.value : left.value - right.value,
|
||||||
|
steps: [...left.steps, { type: 'op', op }, ...right.steps],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return left;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseMulDiv() {
|
||||||
|
let left = parseUnary();
|
||||||
|
while (peek() === '*' || peek() === '/') {
|
||||||
|
const op = consume();
|
||||||
|
const right = parseUnary();
|
||||||
|
if (op === '/' && right.value === 0) throw new Error('Division by zero');
|
||||||
|
left = {
|
||||||
|
value: op === '*' ? left.value * right.value : Math.floor(left.value / right.value),
|
||||||
|
steps: [...left.steps, { type: 'op', op }, ...right.steps],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return left;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseUnary() {
|
||||||
|
if (peek() === '-') {
|
||||||
|
consume();
|
||||||
|
const r = parsePrimary();
|
||||||
|
return { value: -r.value, steps: [{ type: 'op', op: '-' }, ...r.steps] };
|
||||||
|
}
|
||||||
|
return parsePrimary();
|
||||||
|
}
|
||||||
|
|
||||||
|
function parsePrimary() {
|
||||||
|
const tok = peek();
|
||||||
|
if (!tok) throw new Error('Unexpected end of expression');
|
||||||
|
|
||||||
|
if (tok === '(') {
|
||||||
|
consume();
|
||||||
|
const inner = parseExpr();
|
||||||
|
if (peek() !== ')') throw new Error('Missing closing )');
|
||||||
|
consume();
|
||||||
|
return {
|
||||||
|
value: inner.value,
|
||||||
|
steps: [{ type: 'op', op: '(' }, ...inner.steps, { type: 'op', op: ')' }],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const diceInfo = parseDiceToken(tok);
|
||||||
|
if (diceInfo) {
|
||||||
|
consume();
|
||||||
|
return rollDice(diceInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/^\d+$/.test(tok)) {
|
||||||
|
consume();
|
||||||
|
const v = parseInt(tok);
|
||||||
|
return { value: v, steps: [{ type: 'const', value: v }] };
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`Unexpected token: ${tok}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function rollDice({ count, sides, mod }) {
|
||||||
|
let rawRolls, kept;
|
||||||
|
|
||||||
|
if (mod === 'adv') {
|
||||||
|
rawRolls = [roll(sides), roll(sides)];
|
||||||
|
kept = [Math.max(...rawRolls)];
|
||||||
|
} else if (mod === 'dis') {
|
||||||
|
rawRolls = [roll(sides), roll(sides)];
|
||||||
|
kept = [Math.min(...rawRolls)];
|
||||||
|
} else if (mod.startsWith('kh')) {
|
||||||
|
const k = parseInt(mod.slice(2));
|
||||||
|
rawRolls = Array.from({ length: count }, () => roll(sides));
|
||||||
|
kept = [...rawRolls].sort((a, b) => b - a).slice(0, k);
|
||||||
|
} else if (mod.startsWith('kl')) {
|
||||||
|
const k = parseInt(mod.slice(2));
|
||||||
|
rawRolls = Array.from({ length: count }, () => roll(sides));
|
||||||
|
kept = [...rawRolls].sort((a, b) => a - b).slice(0, k);
|
||||||
|
} else {
|
||||||
|
rawRolls = Array.from({ length: count }, () => roll(sides));
|
||||||
|
kept = rawRolls.slice();
|
||||||
|
}
|
||||||
|
|
||||||
|
const entry = { sides, rawRolls, kept, mod, value: kept.reduce((a, b) => a + b, 0) };
|
||||||
|
return {
|
||||||
|
value: entry.value,
|
||||||
|
steps: [{ type: 'dice', entry }],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = parseExpr();
|
||||||
|
if (pos < tokens.length) throw new Error(`Unexpected token: ${tokens[pos]}`);
|
||||||
|
return { total: result.value, steps: result.steps };
|
||||||
|
}
|
||||||
17
frontend/i18n/locales.ts
Normal file
17
frontend/i18n/locales.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
export const locales = [
|
||||||
|
{
|
||||||
|
code: 'en',
|
||||||
|
name: 'English',
|
||||||
|
flag: '🇬🇧'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'es',
|
||||||
|
name: 'Español',
|
||||||
|
flag: '🇪🇸'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'ca',
|
||||||
|
name: 'Català',
|
||||||
|
flag: '<27>🇸'
|
||||||
|
}
|
||||||
|
]
|
||||||
1
frontend/i18n/locales/ca/general.json
Normal file
1
frontend/i18n/locales/ca/general.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
14
frontend/i18n/locales/ca/login.json
Normal file
14
frontend/i18n/locales/ca/login.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"username": "Usuari o correu electrònic",
|
||||||
|
"username-placeholder": "Introdueix el teu usuari o correu electrònic...",
|
||||||
|
"password": "Contrasenya",
|
||||||
|
"password-placeholder": "Introdueix la teva contrasenya...",
|
||||||
|
"log-in": "Inicia sessió",
|
||||||
|
"no-account": "No tens un compte?",
|
||||||
|
"register": "Registra't",
|
||||||
|
"errors": {
|
||||||
|
"invalid-credentials": "Usuari/correu o contrasenya incorrectes.",
|
||||||
|
"params": "Si us plau, introdueix usuari/correu i contrasenya."
|
||||||
|
},
|
||||||
|
"success": "Inici de sessió correcte!"
|
||||||
|
}
|
||||||
7
frontend/i18n/locales/ca/main-menu.json
Normal file
7
frontend/i18n/locales/ca/main-menu.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"main-menu": "Menú principal",
|
||||||
|
"edit-profile": "Editar perfil",
|
||||||
|
"create-campaign": "Crear campanya",
|
||||||
|
"log-out": "Tanca la sessió",
|
||||||
|
"settings": "Configuració"
|
||||||
|
}
|
||||||
27
frontend/i18n/locales/ca/register.json
Normal file
27
frontend/i18n/locales/ca/register.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "Nom",
|
||||||
|
"name-placeholder": "Introdueix el teu nom...",
|
||||||
|
"email": "Correu electrònic",
|
||||||
|
"email-placeholder": "Introdueix el teu correu electrònic...",
|
||||||
|
"username": "Usuari",
|
||||||
|
"username-placeholder": "Introdueix el teu nom d'usuari...",
|
||||||
|
"password": "Contrasenya",
|
||||||
|
"password-placeholder": "Introdueix la teva contrasenya...",
|
||||||
|
"confirm-password": "Confirma la contrasenya",
|
||||||
|
"confirm-password-placeholder": "Torna a introduir la contrasenya...",
|
||||||
|
"register": "Registra't",
|
||||||
|
"have-account": "Ja tens un compte?",
|
||||||
|
"login": "Inicia sessió",
|
||||||
|
"password-confirm-placeholder": "Confirma la teva contrasenya...",
|
||||||
|
"welcome": "Benvingut a DragonRoll!",
|
||||||
|
"message": "Si us plau, introdueix el nom d'usuari i la contrasenya que desitges per crear un compte.",
|
||||||
|
"first-register-message": "Estàs a punt de crear el primer compte en aquesta instància de DragonRoll. Aquest compte tindrà privilegis d'administrador.",
|
||||||
|
"errors": {
|
||||||
|
"name-empty": "Si us plau, introdueix el teu nom.",
|
||||||
|
"email-empty": "Si us plau, introdueix un correu electrònic vàlid.",
|
||||||
|
"username-empty": "Si us plau, introdueix un nom d'usuari.",
|
||||||
|
"passwords-no-match": "Les contrasenyes no coincideixen.",
|
||||||
|
"email-username-exists": "Ja existeix un compte amb aquest correu electrònic o nom d'usuari."
|
||||||
|
},
|
||||||
|
"success": "Registre correcte! Ara pots iniciar sessió."
|
||||||
|
}
|
||||||
13
frontend/i18n/locales/ca/settings.json
Normal file
13
frontend/i18n/locales/ca/settings.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"tabs": {
|
||||||
|
"account-settings": "Configuració del compte",
|
||||||
|
"site-administration": "Administració del lloc"
|
||||||
|
},
|
||||||
|
"account-settings": {
|
||||||
|
"appearance": "Aparença",
|
||||||
|
"language": "Idioma"
|
||||||
|
},
|
||||||
|
"site-administration": {
|
||||||
|
"manage-accounts": "Gestiona els comptes"
|
||||||
|
}
|
||||||
|
}
|
||||||
9
frontend/i18n/locales/ca/windows.json
Normal file
9
frontend/i18n/locales/ca/windows.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"login": "Inicia sessió",
|
||||||
|
"register": "Registra't",
|
||||||
|
"main-menu": "Dragonroll",
|
||||||
|
"example": "Finestra d'exemple",
|
||||||
|
"edit-profile": "Editar perfil",
|
||||||
|
"settings": "Configuració",
|
||||||
|
"create-campaign": "Crear campanya"
|
||||||
|
}
|
||||||
@@ -1,16 +1 @@
|
|||||||
{
|
{}
|
||||||
"windows": {
|
|
||||||
"login": "Login",
|
|
||||||
"register": "Register",
|
|
||||||
"example": "Example Window"
|
|
||||||
},
|
|
||||||
"login": {
|
|
||||||
"username": "Username",
|
|
||||||
"username-placeholder": "Enter your username here...",
|
|
||||||
"password": "Password",
|
|
||||||
"password-placeholder": "Enter your password...",
|
|
||||||
"log-in": "Log in",
|
|
||||||
"no-account": "You don't have an account?",
|
|
||||||
"register": "Register"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
10
frontend/i18n/locales/en/campaigns.json
Normal file
10
frontend/i18n/locales/en/campaigns.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"create": {
|
||||||
|
"name": "Name",
|
||||||
|
"description": "Description",
|
||||||
|
"description-placeholder": "Enter a brief description for your campaign...",
|
||||||
|
"enter": "Enter campaign name here...",
|
||||||
|
"color": "Accent color",
|
||||||
|
"success": "Campaign created successfully!"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
frontend/i18n/locales/en/general.json
Normal file
10
frontend/i18n/locales/en/general.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"errors": {
|
||||||
|
"internal": "An internal error occurred."
|
||||||
|
},
|
||||||
|
"create": "Create",
|
||||||
|
"save": "Save",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"delete": "Delete",
|
||||||
|
"open": "Open"
|
||||||
|
}
|
||||||
15
frontend/i18n/locales/en/login.json
Normal file
15
frontend/i18n/locales/en/login.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
{
|
||||||
|
"username": "Username or email",
|
||||||
|
"username-placeholder": "Enter your username or email here...",
|
||||||
|
"password": "Password",
|
||||||
|
"password-placeholder": "Enter your password...",
|
||||||
|
"log-in": "Log in",
|
||||||
|
"no-account": "You don't have an account?",
|
||||||
|
"register": "Register",
|
||||||
|
"errors": {
|
||||||
|
"invalid-credentials": "Invalid username/email or password.",
|
||||||
|
"params": "Please enter both username/email and password."
|
||||||
|
},
|
||||||
|
"success": "Login successful!"
|
||||||
|
}
|
||||||
7
frontend/i18n/locales/en/main-menu.json
Normal file
7
frontend/i18n/locales/en/main-menu.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"main-menu": "Main menu",
|
||||||
|
"edit-profile": "Edit profile",
|
||||||
|
"create-campaign": "Create Campaign",
|
||||||
|
"log-out": "Log out",
|
||||||
|
"settings": "Settings"
|
||||||
|
}
|
||||||
27
frontend/i18n/locales/en/register.json
Normal file
27
frontend/i18n/locales/en/register.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "Name",
|
||||||
|
"name-placeholder": "Enter your name here...",
|
||||||
|
"email": "Email",
|
||||||
|
"email-placeholder": "Enter your email here...",
|
||||||
|
"username": "Username",
|
||||||
|
"username-placeholder": "Enter your username here...",
|
||||||
|
"password": "Password",
|
||||||
|
"password-placeholder": "Enter your password...",
|
||||||
|
"confirm-password": "Confirm Password",
|
||||||
|
"confirm-password-placeholder": "Re-enter your password...",
|
||||||
|
"register": "Register",
|
||||||
|
"have-account": "Already have an account?",
|
||||||
|
"login": "Login",
|
||||||
|
"password-confirm-placeholder": "Confirm your password...",
|
||||||
|
"welcome": "Welcome to DragonRoll!",
|
||||||
|
"message": "Please enter your desired username and password to create an account.",
|
||||||
|
"first-register-message": "You are about to create the first account on this DragonRoll instance. This account will be granted administrator privileges.",
|
||||||
|
"errors": {
|
||||||
|
"name-empty": "Please enter your name.",
|
||||||
|
"email-empty": "Please enter a valid email address.",
|
||||||
|
"username-empty": "Please enter a username.",
|
||||||
|
"passwords-no-match": "The passwords you entered do not match.",
|
||||||
|
"email-username-exists": "An account with this email or username already exists."
|
||||||
|
},
|
||||||
|
"success": "Registration successful! You can now log in."
|
||||||
|
}
|
||||||
13
frontend/i18n/locales/en/settings.json
Normal file
13
frontend/i18n/locales/en/settings.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"tabs": {
|
||||||
|
"account-settings": "Account settings",
|
||||||
|
"site-administration": "Site administration"
|
||||||
|
},
|
||||||
|
"account-settings": {
|
||||||
|
"appearance": "Appearance",
|
||||||
|
"language": "Language"
|
||||||
|
},
|
||||||
|
"site-administration": {
|
||||||
|
"manage-accounts": "Manage accounts"
|
||||||
|
}
|
||||||
|
}
|
||||||
9
frontend/i18n/locales/en/windows.json
Normal file
9
frontend/i18n/locales/en/windows.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"login": "Login",
|
||||||
|
"register": "Register",
|
||||||
|
"main-menu": "Dragonroll",
|
||||||
|
"example": "Example Window",
|
||||||
|
"edit-profile": "Edit Profile",
|
||||||
|
"settings": "Settings",
|
||||||
|
"create-campaign": "Create Campaign"
|
||||||
|
}
|
||||||
1
frontend/i18n/locales/es/general.json
Normal file
1
frontend/i18n/locales/es/general.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
14
frontend/i18n/locales/es/login.json
Normal file
14
frontend/i18n/locales/es/login.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"username": "Usuario o correo electrónico",
|
||||||
|
"username-placeholder": "Introduce tu usuario o correo electrónico...",
|
||||||
|
"password": "Contraseña",
|
||||||
|
"password-placeholder": "Introduce tu contraseña...",
|
||||||
|
"log-in": "Iniciar sesión",
|
||||||
|
"no-account": "¿No tienes una cuenta?",
|
||||||
|
"register": "Registrarse",
|
||||||
|
"errors": {
|
||||||
|
"invalid-credentials": "Usuario/correo o contraseña incorrectos.",
|
||||||
|
"params": "Por favor, introduce usuario/correo y contraseña."
|
||||||
|
},
|
||||||
|
"success": "¡Inicio de sesión exitoso!"
|
||||||
|
}
|
||||||
7
frontend/i18n/locales/es/main-menu.json
Normal file
7
frontend/i18n/locales/es/main-menu.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"main-menu": "Menú principal",
|
||||||
|
"edit-profile": "Editar perfil",
|
||||||
|
"create-campaign": "Crear campanya",
|
||||||
|
"log-out": "Cerrar sesión",
|
||||||
|
"settings": "Configuración"
|
||||||
|
}
|
||||||
27
frontend/i18n/locales/es/register.json
Normal file
27
frontend/i18n/locales/es/register.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "Nombre",
|
||||||
|
"name-placeholder": "Introduce tu nombre...",
|
||||||
|
"email": "Correo electrónico",
|
||||||
|
"email-placeholder": "Introduce tu correo electrónico...",
|
||||||
|
"username": "Usuario",
|
||||||
|
"username-placeholder": "Introduce tu nombre de usuario...",
|
||||||
|
"password": "Contraseña",
|
||||||
|
"password-placeholder": "Introduce tu contraseña...",
|
||||||
|
"confirm-password": "Confirmar contraseña",
|
||||||
|
"confirm-password-placeholder": "Vuelve a introducir tu contraseña...",
|
||||||
|
"register": "Registrarse",
|
||||||
|
"have-account": "¿Ya tienes una cuenta?",
|
||||||
|
"login": "Iniciar sesión",
|
||||||
|
"password-confirm-placeholder": "Confirma tu contraseña...",
|
||||||
|
"welcome": "¡Bienvenido a DragonRoll!",
|
||||||
|
"message": "Por favor, introduce el usuario y la contraseña que deseas para crear una cuenta.",
|
||||||
|
"first-register-message": "Estás a punto de crear la primera cuenta en esta instancia de DragonRoll. Esta cuenta tendrá privilegios de administrador.",
|
||||||
|
"errors": {
|
||||||
|
"name-empty": "Por favor, introduce tu nombre.",
|
||||||
|
"email-empty": "Por favor, introduce un correo electrónico válido.",
|
||||||
|
"username-empty": "Por favor, introduce un nombre de usuario.",
|
||||||
|
"passwords-no-match": "Las contraseñas no coinciden.",
|
||||||
|
"email-username-exists": "Ya existe una cuenta con este correo electrónico o nombre de usuario."
|
||||||
|
},
|
||||||
|
"success": "¡Registro exitoso! Ahora puedes iniciar sesión."
|
||||||
|
}
|
||||||
13
frontend/i18n/locales/es/settings.json
Normal file
13
frontend/i18n/locales/es/settings.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"tabs": {
|
||||||
|
"account-settings": "Configuración de la cuenta",
|
||||||
|
"site-administration": "Administración del sitio"
|
||||||
|
},
|
||||||
|
"account-settings": {
|
||||||
|
"appearance": "Apariencia",
|
||||||
|
"language": "Idioma"
|
||||||
|
},
|
||||||
|
"site-administration": {
|
||||||
|
"manage-accounts": "Gestionar cuentas"
|
||||||
|
}
|
||||||
|
}
|
||||||
9
frontend/i18n/locales/es/windows.json
Normal file
9
frontend/i18n/locales/es/windows.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"login": "Iniciar sesión",
|
||||||
|
"register": "Registrarse",
|
||||||
|
"main-menu": "Dragonroll",
|
||||||
|
"example": "Ventana de ejemplo",
|
||||||
|
"edit-profile": "Editar perfil",
|
||||||
|
"settings": "Configuración",
|
||||||
|
"create-campaign": "Crear campanya"
|
||||||
|
}
|
||||||
@@ -1,4 +1,24 @@
|
|||||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
import { execSync } from 'node:child_process'
|
||||||
|
|
||||||
|
function getGitInfo() {
|
||||||
|
try {
|
||||||
|
const commit = execSync('git rev-parse --short HEAD').toString().trim()
|
||||||
|
const tag = execSync('git describe --tags --abbrev=0').toString().trim()
|
||||||
|
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim()
|
||||||
|
|
||||||
|
return { commit, tag, branch }
|
||||||
|
} catch {
|
||||||
|
// fallback (production / no .git)
|
||||||
|
return {
|
||||||
|
commit: process.env.NUXT_PUBLIC_GIT_COMMIT || 'unknown',
|
||||||
|
tag: process.env.NUXT_PUBLIC_GIT_TAG || 'no-tag',
|
||||||
|
branch: process.env.NUXT_PUBLIC_GIT_BRANCH || 'unknown'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const git = getGitInfo();
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
vite: {
|
vite: {
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
@@ -6,7 +26,8 @@ export default defineNuxtConfig({
|
|||||||
'@vue/devtools-core',
|
'@vue/devtools-core',
|
||||||
'@vue/devtools-kit',
|
'@vue/devtools-kit',
|
||||||
'axios',
|
'axios',
|
||||||
'mitt'
|
'mitt',
|
||||||
|
'motion'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -22,7 +43,11 @@ export default defineNuxtConfig({
|
|||||||
|
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
public: {
|
public: {
|
||||||
apiBaseUrl: process.env.API_BASE_URL || 'http://localhost:5000/api'
|
apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL || 'http://localhost:5000/api',
|
||||||
|
gitCommit: git.commit,
|
||||||
|
gitTag: git.tag,
|
||||||
|
gitBranch: git.branch,
|
||||||
|
buildDate: new Date().toISOString(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
85
frontend/package-lock.json
generated
85
frontend/package-lock.json
generated
@@ -9,7 +9,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxtjs/i18n": "^10.3.0",
|
"@nuxtjs/i18n": "^10.3.0",
|
||||||
"axios": "^1.15.2",
|
"axios": "^1.15.2",
|
||||||
|
"marked": "^18.0.2",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
|
"motion": "^12.38.0",
|
||||||
"nuxt": "^4.4.2",
|
"nuxt": "^4.4.2",
|
||||||
"pixelarticons": "^2.1.0",
|
"pixelarticons": "^2.1.0",
|
||||||
"sass": "^1.99.0",
|
"sass": "^1.99.0",
|
||||||
@@ -7784,6 +7786,33 @@
|
|||||||
"url": "https://github.com/sponsors/rawify"
|
"url": "https://github.com/sponsors/rawify"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/framer-motion": {
|
||||||
|
"version": "12.38.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.38.0.tgz",
|
||||||
|
"integrity": "sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"motion-dom": "^12.38.0",
|
||||||
|
"motion-utils": "^12.36.0",
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@emotion/is-prop-valid": "*",
|
||||||
|
"react": "^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@emotion/is-prop-valid": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fresh": {
|
"node_modules/fresh": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
|
||||||
@@ -8858,6 +8887,18 @@
|
|||||||
"source-map-js": "^1.2.1"
|
"source-map-js": "^1.2.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/marked": {
|
||||||
|
"version": "18.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/marked/-/marked-18.0.2.tgz",
|
||||||
|
"integrity": "sha512-NsmlUYBS/Zg57rgDWMYdnre6OTj4e+qq/JS2ot3KrYLSoHLw+sDu0Nm1ZGpRgYAq6c+b1ekaY5NzVchMCQnzcg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"marked": "bin/marked.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 20"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/math-intrinsics": {
|
"node_modules/math-intrinsics": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||||
@@ -9042,6 +9083,47 @@
|
|||||||
"integrity": "sha512-aF7yRQr/Q0O2/4pIXm6PZ5G+jAd7QS4Yu8m+WEeEHGnbo+7mE36CbLSDQiXYV8bVL3NfmdeqPJct0tUlnjVSnA==",
|
"integrity": "sha512-aF7yRQr/Q0O2/4pIXm6PZ5G+jAd7QS4Yu8m+WEeEHGnbo+7mE36CbLSDQiXYV8bVL3NfmdeqPJct0tUlnjVSnA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/motion": {
|
||||||
|
"version": "12.38.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion/-/motion-12.38.0.tgz",
|
||||||
|
"integrity": "sha512-uYfXzeHlgThchzwz5Te47dlv5JOUC7OB4rjJ/7XTUgtBZD8CchMN8qEJ4ZVsUmTyYA44zjV0fBwsiktRuFnn+w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"framer-motion": "^12.38.0",
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@emotion/is-prop-valid": "*",
|
||||||
|
"react": "^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@emotion/is-prop-valid": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/motion-dom": {
|
||||||
|
"version": "12.38.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.38.0.tgz",
|
||||||
|
"integrity": "sha512-pdkHLD8QYRp8VfiNLb8xIBJis1byQ9gPT3Jnh2jqfFtAsWUA3dEepDlsWe/xMpO8McV+VdpKVcp+E+TGJEtOoA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"motion-utils": "^12.36.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/motion-utils": {
|
||||||
|
"version": "12.36.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.36.0.tgz",
|
||||||
|
"integrity": "sha512-eHWisygbiwVvf6PZ1vhaHCLamvkSbPIeAYxWUuL3a2PD/TROgE7FvfHWTIH4vMl798QLfMw15nRqIaRDXTlYRg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/mrmime": {
|
"node_modules/mrmime": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
||||||
@@ -11410,8 +11492,7 @@
|
|||||||
"version": "2.8.1",
|
"version": "2.8.1",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
"license": "0BSD",
|
"license": "0BSD"
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"node_modules/type-check": {
|
"node_modules/type-check": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "nuxt build",
|
"build": "nuxt build --dotenv .env.production",
|
||||||
"dev": "nuxt dev",
|
"dev": "nuxt dev",
|
||||||
"generate": "nuxt generate",
|
"generate": "nuxt generate",
|
||||||
"preview": "nuxt preview",
|
"preview": "nuxt preview",
|
||||||
@@ -12,7 +12,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxtjs/i18n": "^10.3.0",
|
"@nuxtjs/i18n": "^10.3.0",
|
||||||
"axios": "^1.15.2",
|
"axios": "^1.15.2",
|
||||||
|
"marked": "^18.0.2",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
|
"motion": "^12.38.0",
|
||||||
"nuxt": "^4.4.2",
|
"nuxt": "^4.4.2",
|
||||||
"pixelarticons": "^2.1.0",
|
"pixelarticons": "^2.1.0",
|
||||||
"sass": "^1.99.0",
|
"sass": "^1.99.0",
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
frontend/public/favicon.png
Normal file
BIN
frontend/public/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
frontend/public/img/def-avatar.jpg
Normal file
BIN
frontend/public/img/def-avatar.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
Reference in New Issue
Block a user