Skip to content

Commit

Permalink
bb
Browse files Browse the repository at this point in the history
  • Loading branch information
Fy- committed May 5, 2024
1 parent 9e426e0 commit 8dbdcef
Show file tree
Hide file tree
Showing 23 changed files with 2,592 additions and 17 deletions.
7 changes: 7 additions & 0 deletions fws-obelix-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env sh

set -e
pnpm run build:obelix
cd packages/fws-obelix/dist

npm publish --access public
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"build:js": "pnpm -C packages/fws-js build",
"build:vue": "pnpm -C packages/fws-vue lint:check --fix && pnpm -C packages/fws-vue build",
"build:klb": "pnpm -C packages/klb-vue lint:check --fix && pnpm -C packages/klb-vue build",
"build:obelix": "pnpm -C packages/fws-obelix lint:check --fix && pnpm -C packages/fws-obelix build",
"build": "pnpm run build:types && pnpm run build:js && pnpm run build:vue",
"play": "pnpm -C packages/playground dev",
"build:play": "pnpm run build && pnpm -C packages/playground build"
Expand Down
47 changes: 47 additions & 0 deletions packages/fws-obelix/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const { root } = require("postcss");

/* eslint-env node */
require("@rushstack/eslint-patch/modern-module-resolution");

module.exports = {
root: true,
env: {
es6: true,
browser: true,
node: true,
},
plugins: ["@typescript-eslint"],
settings: {
"import/resolver": {
node: { extensions: [".js", ".mjs", ".ts", ".d.ts", ".tsx"] },
},
},
parser: "vue-eslint-parser",
extends: [
"plugin:vue/vue3-essential",
"@vue/prettier",
"@vue/eslint-config-prettier",
],
parserOptions: {
parser: "@typescript-eslint/parser",
},
rules: {
"vue/valid-v-for": "off",
"vue/html-indent": "off",
"vue/singleline-html-element-content-newline": 0,

camelcase: ["error", { properties: "never" }],
//"no-console": ["warn", { allow: ["error"] }],
"no-empty": ["error", { allowEmptyCatch: true }],
"prefer-const": [
"warn",
{ destructuring: "all", ignoreReadBeforeAssign: true },
],
"prefer-arrow-callback": [
"error",
{ allowNamedFunctions: false, allowUnboundThis: true },
],
// prettier
"prettier/prettier": "error",
},
};
60 changes: 60 additions & 0 deletions packages/fws-obelix/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
dist/
src/styles/__*
src/components.d.ts
# yarn
.rollup.*
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# See http://help.github.com/ignore-files/ for more about ignoring files.
env/

# compiled output
/dist-ssr
/tmp
/out-tsc

# dependencies
/node_modules
*.local
yarn.lock
package-lock.json
yarn-error.log

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
# !.vscode/settings.json
# !.vscode/tasks.json
# !.vscode/launch.json
# !.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log

# e2e
/e2e/src/*.js
/e2e/src/*.map
/cypress/screenshots

# System Files
.DS_Store
Thumbs.db
25 changes: 25 additions & 0 deletions packages/fws-obelix/copyPackage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// copyPackage.js

const fs = require("fs");
const path = require("path");
const sourcePath = path.resolve(__dirname, "package.json");
const targetPath = path.resolve(__dirname, "dist", "package.json");
const packageData = require(sourcePath);
delete packageData.scripts;
delete packageData.devDependencies;
packageData.main = "index.ts";
packageData.module = "index.ts";
packageData.typings = "index.ts";
packageData.types = "index.ts";
packageData.exports = {
".": {
import: "./index.ts",
require: "./index.ts",
browser: "./index.ts",
},
"./style.css": {
import: "./style.css",
require: "./style.css",
},
};
fs.writeFileSync(targetPath, JSON.stringify(packageData, null, 2), "utf-8");
94 changes: 94 additions & 0 deletions packages/fws-obelix/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"name": "@fy-/fws-obelix",
"version": "0.0.01",
"author": "Florian 'Fy' Gasquez <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/fy-to/FWJS.git"
},
"bugs": {
"url": "https://github.com/fy-to/FWJS/issues"
},
"homepage": "https://github.com/fy-to/FWJS#readme",
"main": "src/index.ts",
"module": "src/index.ts",
"typings": "src/index.ts",
"types": "src/index.ts",
"exports": {
".": {
"import": "./src/index.ts",
"require": "./src/index.ts",
"types": "./src/index.ts"
},
"./style.css": {
"import": "./src/style.css",
"require": "./src/style.css"
}
},
"peerDependencies": {
"@fy-/fws-js": "^0.0.x",
"@fy-/fws-types": "^0.0.x",
"@fy-/head": "^0.0.x",
"@vuelidate/core": "^2.0.x",
"@vuelidate/validators": "^2.0.x",
"@vueuse/core": "^10.x.x",
"mitt": "^3.0.x",
"pinia": "2.x.x",
"timeago.js": "^4.0.x",
"vue": "^3.3.x",
"vue-router": "^4.1.x",
"flowbite": "^2.3.x",
"@fy-/fws-vue": "^0.3.x",
"markdown-it": "^14.x.x",
"md-editor-v3": "^4.x.x"
},
"scripts": {
"clean": "rimraf dist",
"type-check": "tsc --noEmit",
"copy": "pnpm run clean && cp -r src/ dist/ && node copyPackage.js",
"build": "pnpm run lint:check --fix && pnpm run type-check && pnpm run copy",
"lint:check": "eslint --resolve-plugins-relative-to . src/ --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore --fix"
},
"devDependencies": {
"@fy-/fws-js": "workspace:*",
"@fy-/fws-types": "workspace:*",
"@fy-/head": "^0.0.39",
"@fy-/fws-vue": "^0.3.67",
"markdown-it": "^14.1.0",
"md-editor-v3": "^4.13.5",
"@headlessui/vue": "^1.7.16",
"@heroicons/vue": "^2.1.1",
"@rushstack/eslint-patch": "^1.6.1",
"@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@vitejs/plugin-vue": "^4.5.2",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/compiler-sfc": "^3.3.13",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/runtime-core": "^3.3.13",
"@vue/server-renderer": "^3.3.13",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^10.7.0",
"eslint": "^8.56.0",
"eslint-plugin-vue": "^9.19.2",
"i18next": "^23.7.11",
"mitt": "^3.0.1",
"pinia": "^2.1.7",
"postcss": "^8.4.32",
"primevue": "^3.51.0",
"rollup": "^4.9.1",
"rollup-plugin-copy": "^3.5.0",
"sass": "^1.69.5",
"typescript": "^5.3.3",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.0.10",
"vue": "^3.3.13",
"vue-router": "^4.2.5",
"vue-tsc": "^1.8.26",
"timeago.js": "^4.0.2"

}

}
68 changes: 68 additions & 0 deletions packages/fws-obelix/src/components/BBFooter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<script setup lang="ts">
import { onMounted, onUnmounted, ref } from "vue";
import { useEventBus, useRest } from "@fy-/fws-vue";
import { useBBStore } from "./bbStore";
const rest = useRest();
const bbStore = useBBStore();
const stats = ref();
async function getStats() {
stats.value = undefined;
const d = await rest("ObelixBB/UserData", "GET");
if (d && d.result === "success") {
stats.value = d.data;
bbStore.setForumsDownvotesPost(d.data.PostDownvotes);
bbStore.setForumsUpvotesPost(d.data.PostUpvotes);
bbStore.setForumsDownvotesComment(d.data.ReplyDownvotes);
bbStore.setForumsUpvotesComment(d.data.ReplyUpvotes);
}
}
const eventBus = useEventBus();
onMounted(() => {
eventBus.on("refreshBBProfile", getStats);
getStats();
});
onUnmounted(() => {
eventBus.off("refreshBBProfile", getStats);
});
</script>

<template>
<footer v-if="stats">
<div class="bb-kik mt-4">
<h4 class="h5 mx-2">
{{ $t("bb_whos_online") }}
</h4>
<div class="bb-kikk">
<p
class="text-sm px-3"
v-html="
$t('bb_whos_online_desc', {
users: stats.Stats.UsersOnline ? stats.Stats.UsersOnline : 0,
total: stats.Stats.TotalOnline ? stats.Stats.TotalOnline : 0,
guests: stats.Stats.GuestsOnline ? stats.Stats.GuestsOnline : 0,
})
"
/>
</div>
</div>
<div class="bb-kik mt-4">
<h4 class="h5 mx-2">
{{ $t("bb_stats") }}
</h4>
<div class="bb-kikk">
<p
class="text-sm px-3"
v-html="
$t('bb_stats_desc', {
boards: stats.Stats.TotalBoards ? stats.Stats.TotalBoards : 0,
posts: stats.Stats.TotalPosts ? stats.Stats.TotalPosts : 0,
replies: stats.Stats.TotalReplies ? stats.Stats.TotalReplies : 0,
users: stats.Stats.TotalUsers ? stats.Stats.TotalUsers : 0,
})
"
/>
</div>
</div>
</footer>
</template>
Loading

0 comments on commit 8dbdcef

Please sign in to comment.