Replace partials with html/react.html.erb

This commit is contained in:
0x1eef 2024-01-13 06:27:19 -03:00
parent 07530d194d
commit 765358b4aa
11 changed files with 27 additions and 34 deletions

View file

@ -2,9 +2,8 @@
##
# GET /
compile '/html/projects/index.html.erb' do
layout "/default.*"
filter(:erb)
compile '/html/react.html.erb', rep: "projects/index" do
filter(:erb, locals: {src: "/js/main/projects.js"})
write('/projects/index.html')
end

View file

@ -2,9 +2,8 @@
##
# GET /tasks/new/
compile '/html/tasks/new/index.html.erb' do
layout "/default.*"
filter(:erb)
compile '/html/react.html.erb', rep: "tasks/new" do
filter(:erb, locals: {src: "/js/main/task/new.js"})
write("/tasks/new/index.html")
end
@ -18,11 +17,9 @@ end
##
# GET /
# GET /tasks/
compile("/html/tasks/index.html.erb") do
layout "/default.*"
filter(:erb)
compile("/html/react.html.erb", rep: "tasks/index") do
filter(:erb, locals: {src: "/js/main/tasks.js"})
write("/tasks/index.html")
write("/index.html")
end
##
@ -34,9 +31,8 @@ end
##
# GET /tasks/edit#id=X
compile("/html/tasks/edit/index.html.erb") do
layout "/default.*"
filter(:erb)
compile("/html/react.html.erb") do
filter(:erb, locals: {src: '/js/main/task/edit.js'})
write("/tasks/edit/index.html")
end

View file

@ -0,0 +1,14 @@
@font-face {
font-family: "Noto Sans Regular";
src: url("/fonts/noto-sans-regular.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans Mono Regular";
src: url("/fonts/noto-sans-mono-regular.ttf") format("truetype");
}
@font-face {
font-family: "Noto Serif Regular";
src: url("/fonts/noto-serif-regular.ttf") format("truetype");
}

View file

@ -1,4 +0,0 @@
<div class='wrapper m-0-auto maxw-1024'>
<div class="react-mount projects"></div>
<script src="/js/main/projects.js"></script>
</div>

View file

@ -7,6 +7,7 @@
<link rel="icon" href="/favicon.svg"/>
</head>
<body>
<%= yield %>
<div class="wrapper react-mount w-full"></div>
<script src="<%= src %>"></script>
</body>
</html>

View file

@ -1,4 +0,0 @@
<div class="wrapper w-full">
<div class="react-mount edit-task"></div>
<script src="/js/main/task/edit.js"></script>
</div>

View file

@ -1,4 +0,0 @@
<div class="wrapper w-full">
<div class="react-mount tasks"></div>
<script src="/js/main/tasks.js"></script>
</div>

View file

@ -1,4 +0,0 @@
<div class="wrapper w-full">
<div class="react-mount new-task"></div>
<script src="/js/main/task/new.js"></script>
</div>

View file

@ -2,7 +2,6 @@ import { ApolloProvider } from "@apollo/client";
import React from "react";
import ReactDOM from "react-dom/client";
import { Task as Component } from "/components/Task";
import { Task } from "/types/schema";
import { ApolloClient, InMemoryCache } from "@apollo/client";
(function () {
@ -16,7 +15,7 @@ import { ApolloClient, InMemoryCache } from "@apollo/client";
uri: "/servlet/graphql",
cache: new InMemoryCache(),
});
const root = document.querySelector(".react-mount.edit-task")!;
const root = document.querySelector(".react-mount")!;
ReactDOM.createRoot(root).render(
<ApolloProvider client={client}>
<Component taskId={Number(params.id)} />

View file

@ -4,7 +4,7 @@ import { Task } from "/components/Task";
import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client";
(function () {
const root = document.querySelector(".react-mount.new-task")!;
const root = document.querySelector(".react-mount")!;
const client = new ApolloClient({
uri: "/servlet/graphql",
cache: new InMemoryCache(),

View file

@ -4,7 +4,7 @@ import ReactDOM from "react-dom/client";
import { Tasks } from "/components/Tasks";
(function () {
const root = document.querySelector(".react-mount.tasks")!;
const root = document.querySelector(".react-mount")!;
const client = new ApolloClient({
uri: "/servlet/graphql",
cache: new InMemoryCache(),