mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 13:22:54 +00:00
fix(ci): fix netlify deployment by building to dist
- Move from root publishing to clean `dist/` directory - Create `scripts/build-dist.mjs` to orchestrate build and copy assets - Update `package.json` build script - Update `netlify.toml` to publish `dist/` - Ignore `dist/` in `.gitignore` Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
ccb60c3a7e
commit
0bfa3b08e8
638 files changed
+193490
-2
No files matched your search
+112
@@ -0,0 +1,112 @@
|
||||
import { devLogger as defaultLogger } from "../utils/logger.js";
|
||||
|
||||
export default class VideoListViewController {
|
||||
constructor({ getSidebarLoadingMarkup, environment = {}, logger } = {}) {
|
||||
this.getSidebarLoadingMarkup =
|
||||
typeof getSidebarLoadingMarkup === "function"
|
||||
? getSidebarLoadingMarkup
|
||||
: () => "";
|
||||
|
||||
this.document = environment.document || (typeof document !== "undefined" ? document : null);
|
||||
this.logger = logger || defaultLogger;
|
||||
}
|
||||
|
||||
isElement(value) {
|
||||
return (
|
||||
typeof HTMLElement !== "undefined" && value instanceof HTMLElement
|
||||
);
|
||||
}
|
||||
|
||||
mount({
|
||||
container = null,
|
||||
popularTagsContainer = null,
|
||||
view,
|
||||
currentVideoList = null,
|
||||
includeTags = true,
|
||||
} = {}) {
|
||||
if (!view) {
|
||||
return { videoList: currentVideoList || null, popularTags: null };
|
||||
}
|
||||
|
||||
const target = container || this.getElementById("videoList");
|
||||
let popularTags = null;
|
||||
if (this.isElement(popularTagsContainer)) {
|
||||
popularTags = popularTagsContainer;
|
||||
} else if (includeTags) {
|
||||
popularTags = this.getElementById("videoListTags");
|
||||
}
|
||||
|
||||
if (typeof view.setPopularTagsContainer === "function") {
|
||||
view.setPopularTagsContainer(popularTags || null);
|
||||
}
|
||||
|
||||
view.mount(target || null);
|
||||
|
||||
return {
|
||||
videoList: target || null,
|
||||
popularTags: popularTags || null,
|
||||
};
|
||||
}
|
||||
|
||||
reinitialize({
|
||||
view,
|
||||
reason,
|
||||
postLoginResult,
|
||||
currentVideoList = null,
|
||||
popularTagsContainer = null,
|
||||
} = {}) {
|
||||
if (!view) {
|
||||
return {
|
||||
videoList: currentVideoList || null,
|
||||
popularTags: null,
|
||||
};
|
||||
}
|
||||
|
||||
const container =
|
||||
this.isElement(currentVideoList) && currentVideoList
|
||||
? currentVideoList
|
||||
: this.getElementById("videoList");
|
||||
|
||||
try {
|
||||
view.destroy();
|
||||
} catch (error) {
|
||||
if (this.logger?.warn) {
|
||||
this.logger.warn(
|
||||
"[VideoListViewController] Failed to destroy VideoListView during reinitialization:",
|
||||
error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const messageContext =
|
||||
reason === "login" && postLoginResult?.blocksLoaded !== false
|
||||
? "Applying your filters…"
|
||||
: "Refreshing videos…";
|
||||
|
||||
let tagsRoot = null;
|
||||
if (this.isElement(popularTagsContainer)) {
|
||||
tagsRoot = popularTagsContainer;
|
||||
} else {
|
||||
tagsRoot = this.getElementById("videoListTags");
|
||||
}
|
||||
if (typeof view.setPopularTagsContainer === "function") {
|
||||
view.setPopularTagsContainer(this.isElement(tagsRoot) ? tagsRoot : null);
|
||||
}
|
||||
|
||||
if (this.isElement(container)) {
|
||||
container.innerHTML = this.getSidebarLoadingMarkup(messageContext);
|
||||
}
|
||||
|
||||
return {
|
||||
videoList: this.isElement(container) ? container : null,
|
||||
popularTags: this.isElement(tagsRoot) ? tagsRoot : null,
|
||||
};
|
||||
}
|
||||
|
||||
getElementById(id) {
|
||||
if (!this.document || typeof this.document.getElementById !== "function") {
|
||||
return null;
|
||||
}
|
||||
return this.document.getElementById(id) || null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user