Skip to content

Commit ba8585c

Browse files
committed
docs: update docs home page
1 parent 3390ec4 commit ba8585c

File tree

10 files changed

+4169
-1378
lines changed

10 files changed

+4169
-1378
lines changed

docs/.vitepress/config.ts

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
1+
import { withPwa } from "@vite-pwa/vitepress";
12
import { defineConfig } from "vitepress";
23
import { author, license } from "../../package.json";
34

45
// https://vitepress.dev/reference/site-config
5-
export default defineConfig({
6-
title: "LeetCode-ts",
7-
description: "Mastering Coding Challenges in TypeScript",
8-
themeConfig: {
9-
siteTitle: "LeetCode-ts",
10-
nav: [
11-
{ text: "Home", link: "/" },
12-
{ text: "Examples", link: "/markdown-examples" },
13-
],
14-
sidebar: [
15-
{
16-
text: "Examples",
17-
items: [
18-
{ text: "Markdown Examples", link: "/markdown-examples" },
19-
{ text: "Runtime API Examples", link: "/api-examples" },
20-
],
6+
export default withPwa(
7+
defineConfig({
8+
title: "LeetCode-ts",
9+
description: "Mastering Coding Challenges in TypeScript",
10+
themeConfig: {
11+
siteTitle: "LeetCode-ts",
12+
nav: [{ text: "Home", link: "/" }],
13+
sidebar: [],
14+
socialLinks: [
15+
{
16+
icon: "github",
17+
link: "https://github.com/Gabb-c/leetcode-ts",
18+
ariaLabel: "Repository link",
19+
},
20+
{
21+
icon: "linkedin",
22+
link: "https://www.linkedin.com/in/gabriel-da-cunha/",
23+
ariaLabel: "LinkedIn link",
24+
},
25+
],
26+
search: {
27+
provider: "local",
28+
},
29+
footer: {
30+
message: `Made with ❤️ Released under the ${license} License`,
31+
copyright: `Copyright © 2024-present ${author.name}`,
2132
},
22-
],
23-
socialLinks: [{ icon: "github", link: "https://github.com/Gabb-c/leetcode-ts" }],
24-
search: {
25-
provider: "local",
26-
},
27-
footer: {
28-
message: `Made with ❤️<br/>Released under the ${license} License`,
29-
copyright: `Copyright © 2024-present ${author.name}`,
3033
},
31-
},
32-
cleanUrls: true,
33-
});
34+
cleanUrls: true,
35+
pwa: { registerType: "autoUpdate" },
36+
}),
37+
);
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<script setup lang="ts">
2+
import { onBeforeMount, ref } from "vue";
3+
4+
const offlineReady = ref(false);
5+
function onOfflineReady() {
6+
offlineReady.value = true;
7+
}
8+
async function close() {
9+
offlineReady.value = false;
10+
}
11+
12+
onBeforeMount(async () => {
13+
const { registerSW } = await import("virtual:pwa-register");
14+
registerSW({
15+
immediate: true,
16+
onOfflineReady,
17+
onRegistered() {
18+
console.info("Service Worker registered");
19+
},
20+
onRegisterError(e) {
21+
console.error("Service Worker registration error!", e);
22+
},
23+
});
24+
});
25+
</script>
26+
27+
<template>
28+
<template v-if="offlineReady">
29+
<div
30+
class="pwa-toast"
31+
role="alertdialog"
32+
aria-labelledby="pwa-message"
33+
>
34+
<div id="pwa-message" class="mb-3">
35+
App ready to work offline
36+
</div>
37+
<button
38+
type="button"
39+
class="pwa-cancel"
40+
@click="close"
41+
>
42+
Close
43+
</button>
44+
</div>
45+
</template>
46+
</template>
47+
48+
<style>
49+
.pwa-toast {
50+
position: fixed;
51+
right: 0;
52+
bottom: 0;
53+
margin: 16px;
54+
padding: 12px;
55+
border: 1px solid #8885;
56+
border-radius: 4px;
57+
z-index: 100;
58+
text-align: left;
59+
box-shadow: 3px 4px 5px 0 #8885;
60+
background-color: white;
61+
}
62+
.pwa-toast #pwa-message {
63+
margin-bottom: 8px;
64+
}
65+
.pwa-toast button {
66+
border: 1px solid #8885;
67+
outline: none;
68+
margin-right: 5px;
69+
border-radius: 2px;
70+
padding: 3px 10px;
71+
}
72+
</style>

docs/.vitepress/theme/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Theme from "vitepress/theme";
2+
import { h } from "vue";
3+
4+
import RegisterSW from "./components/RegisterSW.vue";
5+
6+
export default {
7+
...Theme,
8+
Layout() {
9+
return h(Theme.Layout, null, {
10+
"layout-bottom": () => h(RegisterSW),
11+
});
12+
},
13+
};

docs/api-examples.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

docs/index.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,29 @@ layout: home
33

44
hero:
55
name: "LeetCode-ts"
6-
text: "Mastering Coding Challenges in TypeScript"
7-
tagline: LeetCode problems implemented in TypeScript
6+
text: "Coding Challenges <br>In TypeScript"
7+
tagline: Mastering LeetCode in TypeScript
88
actions:
99
- theme: brand
10-
text: Markdown Examples
11-
link: /markdown-examples
12-
- theme: alt
13-
text: API Examples
14-
link: /api-examples
10+
text: View on GitHub
11+
link: https://github.com/Gabb-c/leetcode-ts
1512

1613
features:
17-
- title: Efficient
18-
details: Optimized solutions for time and space complexity.
19-
- title: Explained
20-
details: Detailed explanations break down the problem and approach.
21-
- title: Tested
22-
details: Unit tests ensure the solution's correctness.
14+
- icon: 🌱
15+
title: Efficient
16+
details: Optimized solutions with minimal time and space complexity.
17+
- icon: 📜
18+
title: Explained
19+
details: In-depth breakdowns of problems and approaches for comprehensive understanding.
20+
- icon: 🧪
21+
title: Tested
22+
details: Ensures solutions correctness through various unit and benchmark tests.
2323
---
24+
25+
---
26+
27+
::: warning 🚧 In Development 🚧
28+
Please note that **this project is currently in its early stages of development**.
29+
While some solutions are complete, others might be under construction or missing entirely.
30+
The documentation is also being built alongside the code, and a contributing guide is on the way.
31+
:::

docs/markdown-examples.md

Lines changed: 0 additions & 85 deletions
This file was deleted.

docs/public/.nojekyll

Whitespace-only changes.

docs/public/robots.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-Agent: *
2+
Allow: /

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@commitlint/cli": "^19.2.2",
3535
"@commitlint/config-conventional": "^19.2.2",
3636
"@types/node": "^20.12.7",
37+
"@vite-pwa/vitepress": "^0.4.0",
3738
"@vitest/coverage-v8": "^1.5.0",
3839
"@vitest/ui": "^1.5.0",
3940
"husky": "^9.0.11",
@@ -42,7 +43,8 @@
4243
"vite-tsconfig-paths": "^4.3.2",
4344
"vitepress": "^1.1.0",
4445
"vitest": "^1.5.0",
45-
"vue": "^3.4.22"
46+
"vue": "^3.4.22",
47+
"workbox-window": "^7.0.0"
4648
},
4749
"pnpm": {
4850
"peerDependencyRules": {

0 commit comments

Comments
 (0)