Skip to content

Commit

Permalink
Added more settings, added spanish translations, optimized the code b…
Browse files Browse the repository at this point in the history
…y reducing the memory copies and more
  • Loading branch information
Patitotective committed Aug 16, 2024
1 parent 6516dc1 commit 43a6932
Show file tree
Hide file tree
Showing 4 changed files with 402 additions and 167 deletions.
14 changes: 9 additions & 5 deletions grado.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ bin = @["app"]
# Dependencies

requires "nim >= 2.0.0"
requires "karax >= 1.2.2"
requires "prologue >= 0.6.4"
requires "sass >= 0.2.0"
requires "kdl >= 2.0.1"
requires "karax == 1.2.2"
requires "prologue == 0.6.4"
requires "sass == 0.2.0"
requires "kdl == 2.0.1"
requires "ni18n == 0.1.0"

task css, "Builds the CSS":
exec "nimble c -r --mm:refc src/buildcss"
Expand All @@ -30,9 +31,12 @@ task frontend, "Compiles the frontend to JavaScript and builds the CSS":
import std/strtabs
import src/config as _

task htmljs, "Generates single html page's JavaScript":
exec "nim js -d:relativePath --out:dist/app.js src/frontend"

task htmlpage, "Generates a single html page":
exec "nimble css"
exec "nim js -d:relativePath --out:dist/app.js src/frontend"
exec "nimble htmljs"

mkDir "dist"
cpFile "public/css/style.css", "dist/style.css"
Expand Down
5 changes: 3 additions & 2 deletions src/frontend.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## This is the module that manipulates the frontend using karax

import std/[dom, json, asyncjs, jsffi, math, jsconsole, enumerate, sugar, strformat, strutils, tables]
import karax/[karax, kajax, karaxdsl, vdom, vstyles, i18n, jdict, languages]
import karax/[karax, kajax, karaxdsl, vdom, vstyles, jdict, languages]

# import matter
import frontend/[routes, utils, patterns]
Expand Down Expand Up @@ -50,11 +50,12 @@ proc render(): VNode =
proc postRender() =
# Since matter needs to find the canvas element, if we load the simulation before karax has created the canvas element it won't work
if not state.matterLoaded:
# Load the simulation until MathJax is done loading
if not MathJax.typesetPromise.isNil:
state.parabola.load()
state.matterLoaded = true
else:
discard setTimeout(postRender, 100)
discard setTimeout(postRender, 300)

# This event is (usually only) called when the user moves back in history
# Here we fake the moving-back-in-history action so it doesn't actually reload the page
Expand Down
Loading

0 comments on commit 43a6932

Please sign in to comment.