Skip to content

Commit

Permalink
improve website
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethosa committed Oct 8, 2023
1 parent 7d48496 commit 6f8a308
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 13 deletions.
32 changes: 21 additions & 11 deletions examples/website/src/docs/introduction.nim
Original file line number Diff line number Diff line change
Expand Up @@ -49,40 +49,49 @@ component Introduction:
tTd: "GitHub"
tTd:
tA(href = "https://github.com/HapticX/happyx"):
tImg(alt = "Github Issues", src = "https://img.shields.io/github/issues/HapticX/happyx?style=for-the-badge")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "Github Issues", src = "https://img.shields.io/github/issues/HapticX/happyx?style=for-the-badge")
tA(href = "https://github.com/HapticX/happyx"):
tImg(alt = "Github Closed Issues", src = "https://img.shields.io/github/issues-closed/HapticX/happyx?style=for-the-badge")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "Github Closed Issues", src = "https://img.shields.io/github/issues-closed/HapticX/happyx?style=for-the-badge")
tA(href = "https://github.com/HapticX/happyx"):
tImg(alt = "Github Stars", src = "https://img.shields.io/github/stars/HapticX/happyx?style=for-the-badge")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "Github Stars", src = "https://img.shields.io/github/stars/HapticX/happyx?style=for-the-badge")
tTr:
tTd: "Tests"
tTd:
tA(href = "https://github.com/HapticX/happyx/actions/workflows/tests.yml"):
tImg(alt = "Github Issues", src = "https://img.shields.io/github/actions/workflow/status/HapticX/HappyX/tests.yml?label=Testing&logo=github&style=for-the-badge")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "Github Issues", src = "https://img.shields.io/github/actions/workflow/status/HapticX/HappyX/tests.yml?label=Testing&logo=github&style=for-the-badge")
tTr:
tTd: "Languages"
tTd:
tA(href = "https://nim-lang.org"):
tImg(alt = "Nim 👑", src = "https://img.shields.io/badge/>=1.6.14-1b1e2b?style=for-the-badge&logo=nim&logoColor=f1fa8c&label=Nim&labelColor=2b2e3b")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "Nim 👑", src = "https://img.shields.io/badge/>=1.6.14-1b1e2b?style=for-the-badge&logo=nim&logoColor=f1fa8c&label=Nim&labelColor=2b2e3b")
tA(href = "https://python.org"):
tImg(alt = "Python 🐍", src = "https://img.shields.io/badge/>=3.7.x-1b1e2b?style=for-the-badge&logo=python&logoColor=f1fa8c&label=Python&labelColor=2b2e3b")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "Python 🐍", src = "https://img.shields.io/badge/>=3.7.x-1b1e2b?style=for-the-badge&logo=python&logoColor=f1fa8c&label=Python&labelColor=2b2e3b")
tA(href = "https://developer.mozilla.org/en-US/docs/Web/JavaScript"):
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "JavaScript ✌", src = "https://img.shields.io/badge/ES6-1b1e2b?style=for-the-badge&logo=javascript&logoColor=f1fa8c&label=JavaScript&labelColor=2b2e3b")
tA(href = "https://www.typescriptlang.org/"):
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "TypeScript 🔥", src = "https://img.shields.io/badge/>=5.2.2-1b1e2b?style=for-the-badge&logo=typescript&logoColor=f1fa8c&label=TypeScript&labelColor=2b2e3b")
tTr:
tTd: "Wakatime Stats"
tTd:
tA(href = "https://wakatime.com/badge/user/eaf11f95-5e2a-4b60-ae6a-38cd01ed317b/project/bbd13748-36e6-4383-ac40-9c4e72c060d1"):
tImg(alt = "Wakatime", src = "https://wakatime.com/badge/user/eaf11f95-5e2a-4b60-ae6a-38cd01ed317b/project/bbd13748-36e6-4383-ac40-9c4e72c060d1.svg?style=for-the-badge")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "Wakatime", src = "https://wakatime.com/badge/user/eaf11f95-5e2a-4b60-ae6a-38cd01ed317b/project/bbd13748-36e6-4383-ac40-9c4e72c060d1.svg?style=for-the-badge")
tTr:
tTd: "VS Code Plugin"
tTd:
tA(href = "https://github.com/HapticX/hpx-vs-code"):
tImg(alt = "VS Code Plugin Repository", src = "https://img.shields.io/badge/Plugin-1b1e2b?style=for-the-badge&logo=visualstudiocode&logoColor=f1fa8c&label=VS%20Code&labelColor=2b2e3b")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "VS Code Plugin Repository", src = "https://img.shields.io/badge/Plugin-1b1e2b?style=for-the-badge&logo=visualstudiocode&logoColor=f1fa8c&label=VS%20Code&labelColor=2b2e3b")
tA(href = "https://marketplace.visualstudio.com/items?itemName=HapticX.happyx"):
tImg(alt = "Visual Studio Marketplace Installs - Azure DevOps Extension", src = "https://img.shields.io/visual-studio-marketplace/azure-devops/installs/total/HapticX.happyx?style=for-the-badge")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "Visual Studio Marketplace Installs - Azure DevOps Extension", src = "https://img.shields.io/visual-studio-marketplace/azure-devops/installs/total/HapticX.happyx?style=for-the-badge")
tTr:
tTd: "PyPI"
tTd:
tA(href = "https://pypi.org/project/happyx/"):
tImg(alt = "PyPI Downloads", src = "https://img.shields.io/pypi/dm/happyx?style=for-the-badge")
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "PyPI Downloads", src = "https://img.shields.io/pypi/dm/happyx?style=for-the-badge")
tTr:
tTd: "npm"
tTd:
tA(href = "https://www.npmjs.com/package/happyx"):
tImg(class = "h-12 lg:h-10 xl:h-8", alt = "Npm Downloads", src = "https://img.shields.io/npm/dm/happyx?style=for-the-badge")
tH2: {translate("What Is HappyX? 💡")}
tP:
tB: "HappyX"
Expand All @@ -103,7 +112,7 @@ component Introduction:
component IntroductionLanguageChooser("Nim", "Nim 👑")
component IntroductionLanguageChooser("Python", "Python 🐍")
component IntroductionLanguageChooser("JavaScript", "JavaScript ✌")
component IntroductionLanguageChooser("TypeScript", "TypeScript ")
component IntroductionLanguageChooser("TypeScript", "TypeScript 🔥")
tP:
tB: {translate("If you:")}
tUl:
Expand Down Expand Up @@ -147,3 +156,4 @@ component Introduction:
component Contributor("Matthew Stopa", "https://github.com/MattStopa", "https://avatars.githubusercontent.com/u/191057?v=4")
component Contributor("Carlo Capocasa", "https://github.com/capocasa", "https://avatars.githubusercontent.com/u/1167940?v=4")
component Contributor("Alikusnadi", "https://github.com/dodolboks", "https://avatars.githubusercontent.com/u/91905?v=4")
component Contributor("XADE", "https://github.com/imxade", "https://avatars.githubusercontent.com/u/56511165?v=4")
2 changes: 2 additions & 0 deletions examples/website/src/docs/path_params.nim
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ component PathParams:
("Nim", "nim", nimCustomPathParamTypeSsr, cstring"nim_import_ssr", newPlayResult()),
("Nim (SPA)", "nim", nimCustomPathParamTypeSpa, cstring"nim_import_ssr", newPlayResult()),
("Python", "python", pythonCustomRouteParamType, cstring"py_import", newPlayResult()),
("JavaScript", "javascript", jsCustomRouteParamType, cstring"js_import", newPlayResult()),
("TypeScript", "typescript", tsCustomRouteParamType, cstring"ts_import", newPlayResult()),
])

if currentLanguage.val in ["Nim", "Nim (SPA)"]:
Expand Down
14 changes: 14 additions & 0 deletions examples/website/src/docs/ssr_basics.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,18 @@ component SsrBasics:
`template`:
tDiv(class = "flex flex-col px-8 py-2 backdrop-blur-sm xl:h-fit gap-4"):
tH1: {translate"Server-side Applications Basics 🖥"}

tP: {translate"This section will provide you with an overview of the core features and capabilities of SSR within HappyX web framework. SSR is a powerful technique that allows you to render web pages on the server-side before sending them to the client, resulting in improved performance and SEO optimization."}

tP: {translate"HappyX server-side allows to use it from Nim, Python and NodeJS!"}

if currentLanguage.val in ["Nim", "Python", "TypeScript", "JavaScript"]:
tP: {translate"Minimal example in any supported language seems like that:"}

component CodeBlockGuide(@[
("Nim", "nim", nimSsrHelloWorldExample, cstring"nim_import_ssr", newPlayResult()),
("Python", "python", pythonHelloWorldExample, cstring"py_import", newPlayResult()),
("JavaScript", "javascript", jsHelloWorldExample, cstring"js_import", newPlayResult()),
("TypeScript", "typescript", tsHelloWorldExample, cstring"ts_import", newPlayResult()),
])

4 changes: 2 additions & 2 deletions examples/website/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>
<meta property="og:image" content="https://hapticx.github.io/happyx/public/icon.png">
<meta property="og:url" content="https://hapticx.github.io/happyx/">
<script src="https://cdn.tailwindcss.com" async></script>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/nim.min.js" async></script>
Expand Down Expand Up @@ -151,7 +151,7 @@
</style>
</head>
<body>
<div id="app" class="w-screen"></div>
<div id="app"></div>
<script src="main.js"></script>
<script>
hljs.highlightAll();
Expand Down
30 changes: 30 additions & 0 deletions examples/website/src/ui/code.nim
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,36 @@ def handle(data: MyUniqueIdentifier):
return {'response': data.identifier}
app.start()
"""
jsCustomRouteParamType* = """import { newPathParamType, Server } from "happyx";
const app = new Server();
// Here is unique identifier, RegExp pattern and function object
newPathParamType("my_unique_id", /\d+/, (data) => {
return Number(data);
});
app.get("/registered/{data:my_unique_id}", (req) => {
return req.params.data;
});
app.start()
"""
tsCustomRouteParamType* = """import { newPathParamType, Server, Request } from "happyx";
const app = new Server();
// Here is unique identifier, RegExp pattern and function object
newPathParamType("my_unique_id", /\d+/, (data: string) => {
return Number(data);
});
app.get("/registered/{data:my_unique_id}", (req: Request) => {
return req.params.data;
});
app.start()
"""
nimAssignRouteParamsSsr* = """import happyx
Expand Down
19 changes: 19 additions & 0 deletions examples/website/src/ui/translations.nim
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,25 @@ translatable:
"zh" -> "以下是路由基础知识。"
"fr" -> "Voici les bases du routage."
"ko" -> "여기는 라우팅 기본 사항입니다."
"This section will provide you with an overview of the core features and capabilities of SSR within HappyX web framework. SSR is a powerful technique that allows you to render web pages on the server-side before sending them to the client, resulting in improved performance and SEO optimization.":
"ru" -> "Этот раздел предоставит вам обзор основных функций и возможностей SSR в рамках веб-фреймворка HappyX. SSR - это мощная техника, которая позволяет рендерить веб-страницы на сервере перед отправкой их клиенту, что приводит к улучшению производительности и оптимизации для SEO."
"ja" -> "このセクションでは、HappyXウェブフレームワーク内のSSRのコア機能と機能について概説します。 SSRは、ウェブページをサーバーサイドでレンダリングしてからクライアントに送信する強力なテクニックで、パフォーマンス向上とSEO最適化が実現されます。"
"zh" -> "本节将为您提供HappyX Web框架内SSR的核心功能和能力概述。 SSR是一种强大的技术,允许您在将网页发送到客户端之前在服务器端呈现它们,从而提高性能并进行SEO优化。"
"fr" -> "Cette section vous fournira un aperçu des fonctionnalités principales et des capacités du SSR au sein du framework web HappyX. Le SSR est une technique puissante qui vous permet de rendre les pages web côté serveur avant de les envoyer au client, ce qui améliore les performances et l'optimisation pour le référencement (SEO)."
"ko" -> "이 섹션은 HappyX 웹 프레임워크 내의 SSR의 핵심 기능 및 능력을 개요로 제공합니다. SSR은 서버 측에서 웹 페이지를 렌더링한 후 클라이언트에게 보내는 강력한 기술로, 성능 향상 및 SEO 최적화를 통해 결과를 도출합니다."
"HappyX server-side allows to use it from Nim, Python and NodeJS!":
"ru" -> "Серверная часть HappyX позволяет использовать ее из Nim, Python и NodeJS!"
"ja" -> "HappyXのサーバーサイドはNim、Python、およびNodeJSから使用できます!"
"zh" -> "HappyX服务器端允许从Nim、Python和NodeJS使用!"
"fr" -> "Le côté serveur de HappyX permet de l'utiliser avec Nim, Python et NodeJS !"
"ko" -> "HappyX 서버 측에서는 Nim, Python 및 NodeJS에서 사용할 수 있습니다!"
"Minimal example in any supported language seems like that:":
"ru" -> "Минимальный пример на любом поддерживаемом языке выглядит так:"
"ja" -> "サポートされている言語の最小の例は次のようになります:"
"zh" -> "任何支持的语言中的最小示例看起来像这样:"
"fr" -> "Un exemple minimal dans n'importe quel langage pris en charge ressemble à ceci :"
"ko" -> "지원되는 어떤 언어에서든 최소한의 예제는 다음과 같습니다:"


var spokenLang: cstring
try:
Expand Down

0 comments on commit 6f8a308

Please sign in to comment.