Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default defineConfig([
rules: {
semi: "error",
"prefer-const": "error",
"@typescript-eslint/no-explicit-any": "off"
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shell</title>
<title>Moduflix</title>
</head>

<body>
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
50 changes: 50 additions & 0 deletions public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createPinia } from "pinia";
import { createApp } from "vue";

import { router } from "./routes/routes";
import router from "./routes/routes";
import App from "./App.vue";

const app = createApp(App);
Expand Down
12 changes: 12 additions & 0 deletions src/routes/loaders/loadLandingRemote.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { applyDocumentMeta } from "../../utils/applyDocumentMeta";

export async function loadLandingRemote() {
const remote = await import("landing/Landing");

applyDocumentMeta({
title: "Moduflix - Landing",
description: "Application with Vue.js",
});

return remote.default;
}
12 changes: 9 additions & 3 deletions src/routes/routes.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { createRouter, createWebHistory } from "vue-router";

import Auth from "../views/Auth.vue";
import Landing from "../views/Landing.vue";
import Catalog from "../views/Catalog.vue";
import Player from "../views/Player.vue";
import { loadLandingRemote } from "./loaders/loadLandingRemote";

const routes = [
{ path: "/", component: Landing },
{ path: "/", component: loadLandingRemote },
{ path: "/auth", component: Auth },
{ path: "/catalog", component: Catalog },
{ path: "/player", component: Player },
];

export const router = createRouter({ history: createWebHistory(), routes });
const router = createRouter({ history: createWebHistory(), routes });

(window as any).shellNavigate = (to: string) => {
router.push(to);
};

export default router;
7 changes: 7 additions & 0 deletions src/types/landing.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-empty-object-type */
declare module "landing/Landing" {
import { DefineComponent } from "vue";
const component: DefineComponent<{}, {}, any>;
export default component;
}
25 changes: 25 additions & 0 deletions src/utils/applyDocumentMeta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export function applyDocumentMeta({
title,
description,
}: {
title?: string;
description?: string;
}) {
if (title) {
document.title = title;
}

if (description) {
let metaDesc = document.querySelector(
'meta[name="description"]',
) as HTMLMetaElement | null;

if (!metaDesc) {
metaDesc = document.createElement("meta");
metaDesc.name = "description";
document.head.appendChild(metaDesc);
}

metaDesc.content = description;
}
}
Loading