diff --git a/esbuild.mjs b/esbuild.mjs index 659302a..cf7d37a 100644 --- a/esbuild.mjs +++ b/esbuild.mjs @@ -17,7 +17,7 @@ build({ target: ["es6"], format: "iife", loader: {".ts": "ts"}, - sourcemap: !isProdEnv, + sourcemap: false, // !isProdEnv, minify: isProdEnv, keepNames: !isProdEnv }).catch(() => process.exit(1)); \ No newline at end of file diff --git a/package.json b/package.json index 30d7192..5713067 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@types/ejs": "^3.1.5", "@types/express": "^5.0.1", "@types/jquery": "^3.5.32", + "@types/lodash": "^4.17.16", "@types/node": "^22.14.1", "@zerollup/ts-transform-paths": "^1.7.18", "autoprefixer": "^10.4.21", @@ -49,6 +50,7 @@ "dependencies": { "@floating-ui/dom": "^1.6.13", "@preline/datatable": "^3.0.0", + "@preline/datepicker": "^3.0.1", "@preline/dropdown": "^3.0.1", "@preline/overlay": "^3.0.0", "@preline/select": "^3.0.0", @@ -59,10 +61,13 @@ "datatables.net-select-dt": "^3.0.0", "discord.js": "^14.18.0", "dotenv": "^16.5.0", + "dropzone": "^6.0.0-beta.2", "ejs": "^3.1.10", "ejs-mate": "^4.0.0", "express": "^5.1.0", "jquery": "^3.7.1", + "lodash": "^4.17.21", + "nouislider": "^15.8.1", "preline": "^3.0.1", "sqlite3": "^5.1.7", "tsconfig-paths": "^4.2.0", diff --git a/src/client/src/ts/guild/feeds.ts b/src/client/src/ts/guild/feeds.ts index 2304fff..25570a2 100644 --- a/src/client/src/ts/guild/feeds.ts +++ b/src/client/src/ts/guild/feeds.ts @@ -1,5 +1,4 @@ import $ from "jquery"; -import "datatables.net-select-dt"; import HSDropdown from "@preline/dropdown"; import HSOverlay, { IOverlayOptions } from "@preline/overlay"; import HSSelect, { ISelectOptions } from "@preline/select"; @@ -8,17 +7,15 @@ import DataTable, { Api, ConfigColumnDefs, AjaxSettings } from "datatables.net-d import { autoUpdate, computePosition, offset } from "@floating-ui/dom"; import { formatTimestamp, verifyChannels } from "../../../src/ts/main"; import prisma from "../../../../../generated/prisma"; +import HSDatepicker, { ICustomDatepickerOptions } from "@preline/datepicker"; declare let guildId: string; declare let channels: Array; + // #region DataTable // -// Fix dependency bugs with preline -(window as any).DataTable = DataTable; -(window as any).$hsDataTableCollection = []; - const emptyTableHtml: string = `
@@ -320,7 +317,6 @@ $("#deleteRowsBtn").on("click", async () => { // #region Page Size Select // https://preline.co/plugins/html/advanced-select.html -(window as any).$hsSelectCollection = []; (window as any)["FloatingUIDOM"] = { computePosition: computePosition, autoUpdate: autoUpdate, @@ -572,6 +568,25 @@ const styleSelect = new HSSelect( styleSelectOptions ); +const publishedThresholdOptions: ICustomDatepickerOptions = { + type: "default", + dateMax: "2050-00-00", + mode: "default", + layouts: { + + }, + inputModeOptions: { itemsSeparator: " / " }, + templates: { + arrowPrev: '', + arrowNext: '' + } +}; + +// const publishedThresholdInput = new HSDatepicker( +// $("#formPublishedThreshold").get(0), +// publishedThresholdOptions +// ); + $("#editForm").on("submit", async event => { event.preventDefault(); diff --git a/src/client/src/ts/main.ts b/src/client/src/ts/main.ts index 794ac52..9630fc0 100644 --- a/src/client/src/ts/main.ts +++ b/src/client/src/ts/main.ts @@ -1,6 +1,23 @@ import { Channel } from "discord.js"; import prisma from "../../../../generated/prisma"; +import $ from "jquery"; +import _ from "lodash"; +import noUiSlider from "nouislider"; +import "datatables.net"; +import "dropzone/dist/dropzone-min.js"; +import * as VanillaCalendarPro from "vanilla-calendar-pro"; + +import "../types/client.d.ts"; + +// Preline requirements +window._ = _; +window.$ = $; +window.jQuery = $; +window.DataTable = $.fn.dataTable; +window.noUiSlider = noUiSlider; +window.VanillaCalendarPro = VanillaCalendarPro; + // Preline: necessary for header events. window.addEventListener("load", () => { const inputs = document.querySelectorAll('.dt-container thead input'); diff --git a/src/client/src/types/client.d.ts b/src/client/src/types/client.d.ts new file mode 100644 index 0000000..3325a84 --- /dev/null +++ b/src/client/src/types/client.d.ts @@ -0,0 +1,15 @@ +import type { IStaticMethods } from "preline/dist"; + +interface Window { + // Optional third-party libraries + _: any; + $: typeof import("jquery"); + jQuery: typeof import("jquery"); + DataTable: any; + Dropzone: any; + VanillaCalendarPro: any; + noUiSlider: any; + + // Preline UI + HSStaticMethods: IStaticMethods; +} \ No newline at end of file diff --git a/src/client/tsconfig.json b/src/client/tsconfig.json index a9652bb..99a9db4 100644 --- a/src/client/tsconfig.json +++ b/src/client/tsconfig.json @@ -3,11 +3,16 @@ "target": "ES5", "outDir": "./public/generated/js", "rootDir": "./src/ts", + "baseUrl": ".", "sourceMap": false, "esModuleInterop": true, - "noImplicitAny": true + "noImplicitAny": true, + "typeRoots": [ + "./src/types" + ] }, "include": [ - "./src/ts/**/*" + "./src/ts/**/*", + "./src/types" ] } \ No newline at end of file diff --git a/src/client/views/guild/feeds.ejs b/src/client/views/guild/feeds.ejs index 7d47462..dfdc0b4 100644 --- a/src/client/views/guild/feeds.ejs +++ b/src/client/views/guild/feeds.ejs @@ -211,7 +211,14 @@

- placeholder for publish threshold + + +

+ placeholder helper text. +

+