Don't remember + styles

This commit is contained in:
djkato 2024-12-26 23:09:54 +01:00
parent 4b53dcd652
commit bc203a0113
17 changed files with 4037 additions and 542 deletions

3
.env
View file

@ -1,2 +1,3 @@
DB_URL=http://localhost:4000
DB_USER=saleor-marketplace DB_USER=saleor-marketplace
DB_PASSWORD="{%cA_#dr}{3'ZDGC,Jy<+S-_M+FE?]][Cu#N`D_V" DB_PASSWORD="{%cA_#dr}{3ZDGC,Jy<+S-_M+FE?]][Cu#ND_V"

749
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -19,17 +19,17 @@ tokio = { version = "1", features = [
], optional = true } ], optional = true }
tower = { version = "0.5.1", optional = true } tower = { version = "0.5.1", optional = true }
tower-http = { version = "0.6.1", features = ["fs"], optional = true } tower-http = { version = "0.6.1", features = ["fs"], optional = true }
wasm-bindgen = "0.2.95" wasm-bindgen = "=0.2.93"
thiserror = "1" thiserror = "1"
tracing = { version = "0.1", optional = true } tracing = { version = "0.1", optional = true }
http = "1" http = "1"
pulldown-cmark = "0.12.2" pulldown-cmark = "0.12.2"
surrealdb = { version = "2.0.4", features = ["kv-rocksdb"], optional = true } surrealdb = { version = "2.0.4", optional = true }
serde = { version = "1.0.202", features = ["derive"] } serde = { version = "1.0.214", features = ["derive"] }
semver = { version = "1.0.23", features = ["serde"] } semver = { version = "1.0.23", features = ["serde"] }
saleor-app-sdk = { version = "0.2.3", default-features = false } saleor-app-sdk = { version = "0.2.3", default-features = false }
chrono = { version = "0.4.38", features = ["serde"] } chrono = { version = "0.4.38", features = ["serde"] }
strum = { version = "0.26.2", features = ["derive"] } strum = { version = "0.26.3", features = ["derive"] }
[features] [features]
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"] hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]

3047
design/logo.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 189 KiB

View file

@ -0,0 +1,504 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="1920"
height="3000"
viewBox="0 0 1920 3000"
version="1.1"
id="svg1"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
sodipodi:docname="logo.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#ffffff"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#505050"
inkscape:document-units="px"
showguides="true"
inkscape:zoom="62.476812"
inkscape:cx="734.38446"
inkscape:cy="-374.05077"
inkscape:window-width="3072"
inkscape:window-height="1700"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:page
x="0"
y="0"
width="1920"
height="3000"
id="page1"
margin="0"
bleed="0" />
<inkscape:page
x="691.36816"
y="-402.01205"
width="100"
height="100"
id="page2"
margin="0"
bleed="0" />
<sodipodi:guide
position="741.31633,3364.7948"
orientation="1,0"
id="guide34"
inkscape:locked="false" />
<sodipodi:guide
position="730.41033,3371.9618"
orientation="1,0"
id="guide35"
inkscape:locked="false" />
<sodipodi:guide
position="721.20923,3380.6361"
orientation="1,0"
id="guide48"
inkscape:locked="false" />
<sodipodi:guide
position="747.33833,3371.9618"
orientation="1,0"
id="guide49"
inkscape:locked="false" />
<sodipodi:guide
position="724.38833,3364.7948"
orientation="0,-1"
id="guide50"
inkscape:locked="false" />
</sodipodi:namedview>
<defs
id="defs1">
<linearGradient
id="swatch51">
<stop
style="stop-color:#0063f6;stop-opacity:1;"
offset="0"
id="stop51" />
</linearGradient>
<linearGradient
id="first-section-bg_svg__a"
x1="1095"
x2="1158.45"
y1="417"
y2="290.21"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-463,-745)">
<stop
stop-color="#fff"
stop-opacity="0"
id="stop15" />
<stop
offset="0.1"
stop-color="#A78CF2"
id="stop16" />
<stop
offset="0.5"
stop-color="#C2BDFF"
id="stop17" />
<stop
offset="1"
stop-color="#fff"
stop-opacity="0"
id="stop18" />
<stop
offset="1"
stop-color="#AD8CF2"
id="stop19" />
</linearGradient>
<linearGradient
id="first-section-bg_svg__b"
x1="345"
x2="422.71"
y1="554"
y2="417.69"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-463,-745)">
<stop
stop-color="#fff"
stop-opacity="0"
id="stop20" />
<stop
offset="0.1"
stop-color="#FFC700"
id="stop21" />
<stop
offset="0.5"
stop-color="#FFE600"
id="stop22" />
<stop
offset="1"
stop-color="#fff"
stop-opacity="0"
id="stop23" />
<stop
offset="1"
stop-color="#FFD600"
id="stop24" />
</linearGradient>
<linearGradient
id="first-section-bg_svg__c"
x1="511"
x2="440.62"
y1="657"
y2="640.5"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-463,-745)">
<stop
stop-color="#fff"
stop-opacity="0"
id="stop25" />
<stop
offset="0.1"
stop-color="#32C100"
id="stop26" />
<stop
offset="0.5"
stop-color="#32C100"
id="stop27" />
<stop
offset="1"
stop-color="#fff"
stop-opacity="0"
id="stop28" />
<stop
offset="1"
stop-color="#32C100"
id="stop29" />
</linearGradient>
<linearGradient
id="first-section-bg_svg__d"
x1="509"
x2="530.88"
y1="115"
y2="34.67"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-463,-745)">
<stop
stop-color="#fff"
stop-opacity="0"
id="stop30" />
<stop
offset="0.1"
stop-color="#0085FF"
id="stop31" />
<stop
offset="0.5"
stop-color="#0085FF"
id="stop32" />
<stop
offset="1"
stop-color="#fff"
stop-opacity="0"
id="stop33" />
<stop
offset="1"
stop-color="#0085FF"
id="stop34" />
</linearGradient>
<linearGradient
id="first-section-bg_svg__e"
x1="609"
x2="630.88"
y1="415"
y2="334.67"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-463,-745)">
<stop
stop-color="#fff"
stop-opacity="0"
id="stop35" />
<stop
offset="0.1"
stop-color="#0085FF"
id="stop36" />
<stop
offset="0.5"
stop-color="#0085FF"
id="stop37" />
<stop
offset="1"
stop-color="#fff"
stop-opacity="0"
id="stop38" />
<stop
offset="1"
stop-color="#0085FF"
id="stop39" />
</linearGradient>
<linearGradient
id="first-section-bg_svg__g"
x1="737.53"
x2="703.15"
y1="637.3"
y2="645.09"
gradientUnits="userSpaceOnUse">
<stop
stop-color="#fff"
stop-opacity="0.43"
id="stop40" />
<stop
offset="0.12"
stop-color="#fff"
stop-opacity="0.4"
id="stop41" />
<stop
offset="0.31"
stop-color="#fff"
stop-opacity="0.72"
id="stop42" />
<stop
offset="0.54"
stop-color="#fff"
stop-opacity="0.33"
id="stop43" />
<stop
offset="1"
stop-color="#fff"
stop-opacity="0.44"
id="stop44" />
</linearGradient>
<filter
id="first-section-bg_svg__f"
width="102.57"
height="102.57"
x="668.72"
y="589.81"
color-interpolation-filters="sRGB"
filterUnits="userSpaceOnUse">
<feFlood
flood-opacity="0"
result="BackgroundImageFix"
id="feFlood44" />
<feColorMatrix
in="SourceAlpha"
result="hardAlpha"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
id="feColorMatrix44" />
<feOffset
dy="3.09"
id="feOffset44" />
<feGaussianBlur
stdDeviation="3.09"
id="feGaussianBlur44" />
<feComposite
in2="hardAlpha"
operator="out"
id="feComposite44" />
<feColorMatrix
values="0 0 0 0 0.0941176 0 0 0 0 0.160784 0 0 0 0 0.231373 0 0 0 0.26 0"
id="feColorMatrix45" />
<feBlend
in2="BackgroundImageFix"
result="effect1_dropShadow_3307_14692"
id="feBlend45" />
<feBlend
in="SourceGraphic"
in2="effect1_dropShadow_3307_14692"
result="shape"
id="feBlend46" />
</filter>
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g10"
inkscape:label="REF">
<g
id="g2"
transform="translate(-172.35194,0.51219002)">
<path
fill="#161a1e"
d="m 714.19011,-437.83448 h -16.928 l -6.022,7.167 h 16.928 z"
id="path1" />
<path
fill="#161a1e"
fill-rule="evenodd"
d="m 738.75011,-430.16148 c -1.768,0 -2.4,-0.383 -2.4,-1.66 0,-1.15 0.632,-1.61 2.532,-1.61 h 1.9 v 1.328 c 0,1.278 -0.633,1.942 -2.031,1.942 m -1.636,2.812 c 2.058,0 2.982,-0.665 3.642,-1.636 v 1.485 h 3.72 v -9.28 c 0,-3.09 -1.187,-4.65 -5.304,-4.65 -3.985,0 -5.942,1.364 -5.942,4.446 l 3.68,0.046 c 0.025,-0.128 0.072,-0.292 0.102,-0.401 0.244,-0.894 0.665,-1.177 2.029,-1.177 1.477,0 1.715,0.613 1.715,1.635 v 0.946 h -1.742 c -4.723,0 -6.333,1.43 -6.333,4.344 0,2.862 1.452,4.242 4.433,4.242"
clip-rule="evenodd"
id="path2" />
<path
fill="#161a1e"
d="m 727.12011,-431.88548 h -0.002 c -0.267,-0.43 -0.892,-0.613 -1.939,-0.808 l -0.365,-0.06 c -2.377,-0.392 -5.333,-0.878 -5.308,-4.182 0,-2.683 1.478,-4.37 5.673,-4.37 3.826,0 5.5,1.636 5.57,4.37 l -3.604,0.076 c -0.132,-1.2 -0.617,-1.61 -2.041,-1.61 -1.162,0 -1.904,0.308 -1.904,1.125 0,1.098 0.818,1.252 2.613,1.559 2.294,0.375 5.046,0.944 5.172,3.9 q 0.008,0.143 0.006,0.293 c 0,2.683 -1.478,4.369 -5.673,4.369 -3.827,0 -5.62,-1.636 -5.69,-4.37 l 3.664,-0.076 c 0.132,1.2 0.706,1.61 2.13,1.61 1.162,0 1.874,-0.307 1.874,-1.125 0,-0.292 -0.058,-0.521 -0.177,-0.7 m 19.441,-10.808 3.8,-4.531 v 19.728 h -3.8 z"
id="path3" />
<path
fill="#161a1e"
fill-rule="evenodd"
d="m 771.74211,-427.28048 c 4.354,0 6.147,-2.224 6.147,-5.213 v -3.68 c 0,-3.041 -1.793,-5.213 -6.147,-5.213 -4.354,0 -6.096,2.172 -6.096,5.213 v 3.68 c 0,2.99 1.715,5.213 6.096,5.213 m 0,-2.965 c -1.531,0 -2.296,-0.792 -2.296,-2.07 v -3.935 c 0,-1.303 0.765,-2.095 2.295,-2.095 1.53,0 2.348,0.792 2.348,2.096 v 3.934 c 0,1.278 -0.818,2.07 -2.347,2.07 m -15.811,-5.57 v -0.69 c 0,-1.202 0.554,-2.02 2.216,-2.02 1.61,0 2.138,0.691 2.138,2.02 v 0.69 z m 2.215,8.535 c 3.544,0 4.98,-1.338 5.54,-2.932 0.116,-0.329 0.194,-0.67 0.246,-1.01 0.013,-0.209 0.017,-0.343 0.02,-0.417 l -3.643,-0.09 c 0,0.015 -0.006,0.06 -0.006,0.06 0,0 -0.045,0.28 -0.079,0.416 -0.198,0.8 -0.634,1.213 -2.077,1.213 -1.82,0 -2.217,-0.895 -2.217,-2.07 v -1.124 h 8.022 v -2.454 c 0,-3.424 -1.345,-5.698 -5.805,-5.698 -4.407,0 -5.91,2.3 -5.91,5.213 v 3.68 c 0,2.836 1.529,5.213 5.91,5.213"
clip-rule="evenodd"
id="path4" />
<path
fill="#161a1e"
d="m 788.46811,-441.26748 -3.134,3.737 -0.031,0.032 h -2.036 v 10.003 h -3.8 v -10.008 l 3.156,-3.763 z"
id="path5" />
</g>
<rect
width="82"
height="82"
x="679"
y="597"
fill="#161a1e"
rx="5.4699998"
id="rect13"
transform="translate(-149.70375,-991.30986)" />
<rect
width="86.099998"
height="86.099998"
x="676.95001"
y="594.95001"
stroke="#ffffff"
stroke-width="4.1"
rx="7.52"
id="rect15"
transform="translate(-149.70375,-991.30986)" />
<path
fill="url(#first-section-bg_svg__g)"
fill-rule="evenodd"
d="M 712.24,633 702,643.93 h 25.3 L 737.52,633 h -25.3 z"
clip-rule="evenodd"
id="path14"
style="fill:url(#first-section-bg_svg__g)"
transform="translate(-149.70375,-991.30986)" />
<path
fill="#ffffff"
fill-opacity="0.8"
fill-rule="evenodd"
d="M 712.24,633 702,643.93 h 25.3 L 737.52,633 h -25.3 z"
clip-rule="evenodd"
id="path15"
transform="translate(-149.70375,-991.30986)" />
<g
class="first-section-bg_svg__mobile-translate-y"
filter="url(#first-section-bg_svg__f)"
id="g15"
transform="translate(-149.70375,-991.30986)" />
</g>
<rect
style="fill:#000000;stroke-width:1.13098"
id="rect10"
width="1.2902415"
height="21.888834"
x="724.38831"
y="-386.68359" />
<rect
style="fill:#000000;stroke-width:1.15126"
id="rect10-2"
width="1.2902415"
height="22.681087"
x="380.63611"
y="721.20923"
transform="rotate(-90)" />
<rect
style="fill:#000000;stroke-width:1.03507"
id="rect10-1"
width="1.2902415"
height="18.334051"
x="729.76556"
y="-383.12885" />
<rect
style="fill:#000000;stroke-width:1.25178"
id="use35"
width="3.635"
height="2"
x="732.26373"
y="-373.96176"
rx="2.7755576e-17"
ry="2.7755576e-17"
inkscape:tile-x0="730.41033"
inkscape:tile-y0="-373.9618"
inkscape:tile-cx="732.22783"
inkscape:tile-cy="-372.9618"
inkscape:tile-w="3.635"
inkscape:tile-h="2"
transform="translate(-1.8534029,-3.8525391e-5)" />
<use
x="0"
y="0"
inkscape:tiled-clone-of="#use35"
xlink:href="#use35"
id="use43"
transform="translate(0,-1)" />
<use
x="0"
y="0"
inkscape:tiled-clone-of="#use35"
xlink:href="#use35"
transform="translate(0,0.99999997)"
id="use44" />
<use
x="0"
y="0"
inkscape:tiled-clone-of="#use35"
xlink:href="#use35"
transform="translate(3.6670119,-4.4732886)"
id="use45" />
<use
x="0"
y="0"
inkscape:tiled-clone-of="#use35"
xlink:href="#use35"
transform="translate(3.635,0.99999997)"
id="use46" />
<use
x="0"
y="0"
inkscape:tiled-clone-of="#use35"
xlink:href="#use35"
transform="translate(7.27,-1)"
id="use47" />
<use
x="0"
y="0"
inkscape:tiled-clone-of="#use35"
xlink:href="#use35"
transform="translate(7.27,0.99999997)"
id="use48" />
<rect
style="fill:none;stroke:#000000;stroke-opacity:1;stroke-width:0.1;stroke-dasharray:none"
id="rect50"
width="26.129101"
height="26.129101"
x="723.06262"
y="-390.92386"
transform="translate(-1.8534029,-3.8525391e-5)" />
<path
style="fill:none;stroke:#000000;stroke-width:0.3;stroke-dasharray:none;stroke-opacity:1"
d="m 734.89516,-378.43509 v -2.20102"
id="path50" />
<use
x="0"
y="0"
xlink:href="#path50"
id="use50"
transform="translate(1.9930041)"
style="stroke-width:1.00200009;stroke-dasharray:none" />
<use
x="0"
y="0"
xlink:href="#use46"
id="use51"
transform="translate(7.2700098)" />
<path
fill="#161a1e"
d="m 747.33833,-371.96177 h -16.928 l -6.022,7.167 h 16.928 z"
id="path1-0" />
<rect
style="fill:#0063f6;stroke:none;stroke-width:0.3;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
id="rect51"
width="26.129101"
height="2.445447"
x="721.20923"
y="-367.24023" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

BIN
design/palette.ase Normal file

Binary file not shown.

7
design/palette.svg Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Exported from Coolors.co - https://coolors.co/101417-fef9ef-094074-227c9d-1da0a8-17c3b2-ffcb77-db8fc8-fe6d73 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 500 250" xml:space="preserve">
<rect fill="#101417" x="0" y="0" width="55.55555555555556" height="220"/>,<rect fill="#fef9ef" x="55.55555555555556" y="0" width="55.55555555555556" height="220"/>,<rect fill="#094074" x="111.11111111111111" y="0" width="55.55555555555556" height="220"/>,<rect fill="#227c9d" x="166.66666666666669" y="0" width="55.55555555555556" height="220"/>,<rect fill="#1da0a8" x="222.22222222222223" y="0" width="55.55555555555556" height="220"/>,<rect fill="#17c3b2" x="277.77777777777777" y="0" width="55.55555555555556" height="220"/>,<rect fill="#ffcb77" x="333.33333333333337" y="0" width="55.55555555555556" height="220"/>,<rect fill="#db8fc8" x="388.8888888888889" y="0" width="55.55555555555556" height="220"/>,<rect fill="#fe6d73" x="444.44444444444446" y="0" width="55.55555555555556" height="220"/>
<text x="10" y="235" font-family="Arial" font-size="6" alignment-baseline="middle">Exported from Coolors.co</text>
<text x="490" y="235" font-family="Arial" font-size="6" alignment-baseline="middle" text-anchor="end">https://coolors.co/101417-fef9ef-094074-227c9d-1da0a8-17c3b2-ffcb77-db8fc8-fe6d73</text>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -2,17 +2,14 @@ services:
surrealdb: surrealdb:
env_file: env_file:
- .env - .env
entrypoint: command:
- /surreal - start
- start - --log=trace
- --auth - --user=$DB_USER
- --user - --pass=$DB_PASSWORD
- $DB_USER # - ./surrealdb/docker-cache/:/db/saleor-marketplace.db
- --pass
- $DB_PASSWORD
- file:/db/saleor-marketplace.db
image: surrealdb/surrealdb:latest image: surrealdb/surrealdb:latest
volumes: volumes:
- ./db:/db - ./surrealdb/docker-cache/:/db
ports: ports:
- 8000:8000 - 4000:8000

View file

@ -18,26 +18,25 @@ pub fn App() -> impl IntoView {
provide_meta_context(); provide_meta_context();
view! { view! {
<Stylesheet id="leptos" href="/pkg/saleor-marketplace.css"/> <Stylesheet id="leptos" href="/pkg/saleor-marketplace.css" />
// sets the document title // sets the document title
<Title text="Saleors Harbour"/> <Title text="Saleors Harbour" />
<Header/> <Header />
// content for this welcome page // content for this welcome page
<Router fallback=|| { <Router fallback=|| {
let mut outside_errors = Errors::default(); let mut outside_errors = Errors::default();
outside_errors.insert_with_default_key(AppError::NotFound); outside_errors.insert_with_default_key(AppError::NotFound);
view! { <ErrorTemplate outside_errors/> }.into_view() view! { <ErrorTemplate outside_errors /> }.into_view()
}> }>
<main class="p-4 md:p-8 md:px-16"> <main class="p-4 md:p-8 md:px-16">
<Routes> <Routes>
<Route path="" view=Home/> <Route path="" view=Home />
<Route path="/apps" view=Apps/> <Route path="/apps" view=Apps />
<Route path="/apps/" view=Apps/> <Route path="/apps/create" view=Apps />
<Route path="/apps/create" view=Apps/> <Route path="/apps/update/:slug" view=Apps />
<Route path="/apps/update/:slug" view=Apps/> <Route path="/guides" view=Guides />
<Route path="/guides" view=Guides/>
</Routes> </Routes>
</main> </main>
</Router> </Router>

View file

@ -5,59 +5,39 @@ use crate::server::types::{AppCategory, DeploymentType};
#[component] #[component]
pub fn app_editor() -> impl IntoView { pub fn app_editor() -> impl IntoView {
let name = create_node_ref(); // let name = create_ // let slug = create_ // let authors = create_ // let built_for_url = create_ // let description = create_ // let version = create_ // let images = create_ // let logo = create_ // let manifest = create_ // let supported_deployments = create_ // let category = create_ // let docker_compose = create_
let slug = create_node_ref();
let authors = create_node_ref();
let built_for_url = create_node_ref();
let description = create_node_ref();
let version = create_node_ref();
let images = create_node_ref();
let logo = create_node_ref();
let manifest = create_node_ref();
let supported_deployments = create_node_ref();
let category = create_node_ref();
let docker_compose = create_node_ref();
view! { view! {
<form> <form>
<label> <label>
<input node_ref=name type="text" placeholder="Name"/> <input type="text" placeholder="Name" />
</label> </label>
<label> <label>
<input node_ref=slug type="text" placeholder="Slug"/> <input type="text" placeholder="Slug" />
</label> </label>
<label> <label>
<input node_ref=authors type="text" placeholder="<Author, authors@email.tld>"/> <input type="text" placeholder="<Author, authors@email.tld>" />
</label> </label>
<label> <label>
<input <input id="built_for_url" placeholder="https://superfaktura.sk/" />
node_ref=built_for_url
id="built_for_url"
placeholder="https://superfaktura.sk/"
/>
</label> </label>
<label> <label>
<textarea <textarea id="description" placeholder="Description"></textarea>
node_ref=description
id="description"
placeholder="Description"
></textarea>
</label> </label>
<label> <label>
<input node_ref=version id="version" type="text" placeholder="Version"/> <input id="version" type="text" placeholder="Version" />
</label> </label>
<label> <label>
<input node_ref=images id="images" type="file" placeholder="Example images"/> <input id="images" type="file" placeholder="Example images" />
</label> </label>
<label> <label>
<input node_ref=logo id="logo" type="file" placeholder="Logo"/> <input id="logo" type="file" placeholder="Logo" />
</label> </label>
<label> <label>
<textarea node_ref=manifest id="manifest" placeholder="JSON"></textarea> <textarea id="manifest" placeholder="JSON"></textarea>
</label> </label>
<label> <label>
<select multiple node_ref=supported_deployments id="supported_deployments"> <select multiple id="supported_deployments">
{move || { {move || {
DeploymentType::iter() DeploymentType::iter()
.map(|d| { .map(|d| {
@ -70,7 +50,7 @@ pub fn app_editor() -> impl IntoView {
</select> </select>
</label> </label>
<label> <label>
<select node_ref=category id="category"> <select id="category">
{move || { {move || {
AppCategory::iter() AppCategory::iter()
.map(|d| { .map(|d| {
@ -83,7 +63,7 @@ pub fn app_editor() -> impl IntoView {
</select> </select>
</label> </label>
<label> <label>
<textarea node_ref=docker_compose id="docker_compose"></textarea> <textarea id="docker_compose"></textarea>
</label> </label>
</form> </form>

View file

@ -52,16 +52,16 @@ pub fn ErrorTemplate(
} }
view! { view! {
<h1>{if errors.len() > 1 {"Errors"} else {"Error"}}</h1> <h1>{if errors.len() > 1 { "Errors" } else { "Error" }}</h1>
<For <For
// a function that returns the items we're iterating over; a signal is fine // a function that returns the items we're iterating over; a signal is fine
each= move || {errors.clone().into_iter().enumerate()} each=move || { errors.clone().into_iter().enumerate() }
// a unique key for each item as a reference // a unique key for each item as a reference
key=|(index, _error)| *index key=|(index, _error)| *index
// renders each item to a view // renders each item to a view
children=move |error| { children=move |error| {
let error_string = error.1.to_string(); let error_string = error.1.to_string();
let error_code= error.1.status_code(); let error_code = error.1.status_code();
view! { view! {
<h2>{error_code.to_string()}</h2> <h2>{error_code.to_string()}</h2>
<p>"Error: " {error_string}</p> <p>"Error: " {error_string}</p>

View file

@ -7,6 +7,10 @@ pub mod components;
pub mod routes; pub mod routes;
pub mod server; pub mod server;
const DB_URL: &str = "http://localhost:4000";
const DB_USER: &str = "saleor-marketplace";
const DB_PASSWORD: &str = r##"{%cA_#dr}{3ZDGC,Jy<+S-_M+FE?]][Cu#ND_V"##;
#[cfg(feature = "hydrate")] #[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen] #[wasm_bindgen::prelude::wasm_bindgen]
pub fn hydrate() { pub fn hydrate() {

View file

@ -1,11 +1,20 @@
pub mod server; pub mod server;
pub mod components; pub mod components;
pub mod routes; pub mod routes;
pub mod migrations;
const DB_URL: &str = "http://localhost:4000";
const DB_USER: &str = "saleor-marketplace";
const DB_PASSWORD: &str = r##"{%cA_#dr}{3ZDGC,Jy<+S-_M+FE?]][Cu#ND_V"##;
#[cfg(feature = "ssr")] #[cfg(feature = "ssr")]
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
let args: Vec<String> = std::env::args().collect();
if args.contains(&"--migrations".to_owned()){
migrations::apply_migrations().await.unwrap();
std::process::exit(0)
}
use axum::Router; use axum::Router;
use leptos::*; use leptos::*;
use leptos_axum::{generate_route_list, LeptosRoutes}; use leptos_axum::{generate_route_list, LeptosRoutes};

17
src/migrations/mod.rs Normal file
View file

@ -0,0 +1,17 @@
use thiserror::Error;
use crate::server;
#[derive(Error, Debug)]
pub enum MigrationError {
#[error("Failed to connect to DB, `{0}`")]
Surreal(#[from] surrealdb::Error),
}
const SCHEMA :&str= include_str!("../../surrealdb/schema.surql");
pub async fn apply_migrations() -> Result<(), MigrationError> {
let client = server::db::connect().await?;
client.query(SCHEMA).await?;
Ok(())
}

View file

@ -1,19 +1,20 @@
use serde::Deserialize; use serde::Deserialize;
use surrealdb::engine::local::Db; use surrealdb::engine::remote::ws::{Client, Ws};
use surrealdb::engine::local::RocksDb;
use surrealdb::sql::Thing; use surrealdb::sql::Thing;
use surrealdb::Surreal; use surrealdb::Surreal;
use crate::DB_URL;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct Record { struct Record {
#[allow(dead_code)] #[allow(dead_code)]
id: Thing, id: Thing,
} }
pub async fn connect() -> surrealdb::Result<Surreal<Db>> { pub async fn connect() -> surrealdb::Result<Surreal<Client>> {
// Create database connection // Create database connection
let db = Surreal::new::<RocksDb>("./db").await?; let db = Surreal::new::<Ws>(DB_URL).await?;
// Select a specific namespace / database // Select a specific namespace / database
db.use_ns("marketplace").use_db("apps").await?; db.use_ns("marketplace").use_db("apps").await?;

View file

@ -1,9 +1,10 @@
#TODO: #TODO:
# - precomputed view for landing page https://surrealdb.com/docs/surrealql/statements/define/table#pre-computed-table-views # [-] precomputed view for landing page https://surrealdb.com/docs/surrealql/statements/define/table#pre-computed-table-views
# - Oauth for github # [-] Oauth for github
# - passwords and sign in # [-] passwords and sign in
# - system user for frontend with EDITOR role scoped to only this db https://surrealdb.com/docs/surrealql/statements/define/user#roles # [-] system user for frontend with EDITOR role scoped to only this db https://surrealdb.com/docs/surrealql/statements/define/user#roles
# - search function https://surrealdb.com/learn/fundamentals/performance/index-data-model#full-text-search-indexes # [-] search function https://surrealdb.com/learn/fundamentals/performance/index-data-model#full-text-search-indexes
# [-] root user
REMOVE NAMESPACE saleor_marketplace; REMOVE NAMESPACE saleor_marketplace;
REMOVE DATABASE main; REMOVE DATABASE main;
@ -237,48 +238,3 @@ DEFINE ACCESS author ON DATABASE TYPE RECORD
} }
DURATION FOR SESSION 12h, FOR TOKEN 5s DURATION FOR SESSION 12h, FOR TOKEN 5s
; ;
DELETE author:djkato;
DELETE app:[
author:djkato,
'stripe-payment-gateway'
];
CREATE author:djkato SET name = 'Djkáťo', socials = [
'https://twitter.com/djkato_vfx'
], email = 'djkatovfx@gmail.com';
CREATE app:[
author:djkato,
'stripe-payment-gateway'
] SET versions = [
'1.0.0'
], slug = [
author:djkato,
'stripe-payment-gateway'
], current_version = '1.0.0', images = [
'https://imgur.com/g/img.jfif'
], is_verified = false, supported_deployments = [
'Docker'
], minimal_docker_compose = '', categories = [
'Payments'
], supported_apls = [
'Redis'
], manifest = {
about: 'cool stripe integration',
app_permissions: [
'MANAGE_USERS'
],
app_url: 'https://app-payment-gateway.test.com',
author: 'Djkáťo <djkatovfx@gmail.com>',
extensions: [],
id: 'stripe-payment-gateway',
name: 'Stripe Payment Gateway',
token_target_url: 'https://app-payment-gateway.test.com/api/register',
version: '1.0.0',
webhooks: []
};
SELECT manifest FROM app:[
author:djkato,
NONE
]..[
author:djkato
];

View file

@ -1,30 +1,44 @@
DELETE user:djkato; DELETE author:djkato;
DELETE saleor_app:[user:djkato, "stripe-payment-gateway"]; DELETE app:[
author:djkato,
CREATE author:djkato SET 'stripe-payment-gateway'
name = "Djkáťo", ];
socials = ["https://twitter.com/djkato_vfx"], CREATE author:djkato SET name = 'Djkáťo', socials = [
email = "djkatovfx@gmail.com"; 'https://twitter.com/djkato_vfx'
], email = 'djkatovfx@gmail.com';
CREATE saleor_app:[author:djkato, "stripe-payment-gateway"] SET CREATE app:[
versions = ["1.0.0"], author:djkato,
current_version = "1.0.0", 'stripe-payment-gateway'
images = ["https://imgur.com/g/img.jfif"], ] SET versions = [
is_verified = false, '1.0.0'
supported_deployments = ["Docker"], ], slug = [
minimal_docker_compose = "", author:djkato,
categories = ["Payments"], 'stripe-payment-gateway'
created= d"2024-09-14T20:58:53.766Z", ], current_version = '1.0.0', images = [
last_updated = d"2024-09-14T20:58:53.766Z", 'https://imgur.com/g/img.jfif'
manifest = { ], is_verified = false, supported_deployments = [
about: "cool stripe integration", 'Docker'
app_permissions: ["MANAGE_USERS"], ], minimal_docker_compose = '', categories = [
app_url: "https://app-payment-gateway.test.com", 'Payments'
author: "Djkáťo <djkatovfx@gmail.com>", ], supported_apls = [
token_target_url: "https://app-payment-gateway.test.com/api/register", 'Redis'
id: "stripe-payment-gateway", ], manifest = {
name: "Stripe Payment Gateway", about: 'cool stripe integration',
version: "1.0", app_permissions: [
}; 'MANAGE_USERS'
],
SELECT manifest FROM saleor_app:[user:djkato, NONE]..[user:djkato]; app_url: 'https://app-payment-gateway.test.com',
author: 'Djkáťo <djkatovfx@gmail.com>',
extensions: [],
id: 'stripe-payment-gateway',
name: 'Stripe Payment Gateway',
token_target_url: 'https://app-payment-gateway.test.com/api/register',
version: '1.0.0',
webhooks: []
};
SELECT manifest FROM app:[
author:djkato,
NONE
]..[
author:djkato
];