Skip to content

Commit

Permalink
spentoday
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-koshchei committed Feb 24, 2024
1 parent 2a2bb15 commit 5294428
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1,483 deletions.
4 changes: 4 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export default defineConfig({
{ text: "Router", link: "/experimental/router" },
],
},
{
text: "Showcase",
items: [{ text: "Spentoday", link: "/showcase/spentoday" }],
},
],

socialLinks: [
Expand Down
Binary file added docs/media/spentoday/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions docs/showcase/spentoday.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
outline: deep
---

# Spentoday

Unator as a library was born during development of [Spentoday](https://www.spentoday.com/).

Spentoday is E-commerce platform for Ukrainian market. User is able to create a shop with free domain or custom one. All shops are separated from each other, so it's more like Shopify rather than marketplace.

## Architecture

![Diagram](../media/spentoday/architecture.png)

In our case Spentoday had a C# ASP.NET Core backend and 2 SvelteKit frontends.
And because we needed to start without spending as little as possible, I designed switches:

- [Email switch](../switches/email.md) to use several email services
- [Storage switch](../switches/storage.md) to use several storages in future
6 changes: 3 additions & 3 deletions src/Web/Email.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void RenderText(StringBuilder sb)
sb.Append('\n');
foreach (var child in children)
{
child.RenderHtml(sb);
child.RenderText(sb);
}
sb.Append('\n');
}
Expand All @@ -79,7 +79,7 @@ public struct HtmlElement(IElement[] children) : IElement
public void RenderHtml(StringBuilder sb)
{
sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
sb.Append("<html>");
sb.Append("<html lang=\"uk\">");
foreach (var child in children)
{
child.RenderHtml(sb);
Expand All @@ -91,7 +91,7 @@ public void RenderText(StringBuilder sb)
{
foreach (var child in children)
{
child.RenderHtml(sb);
child.RenderText(sb);
}
}
}
Expand Down
29 changes: 16 additions & 13 deletions src/Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,26 @@

string? preheader = "Showing Jooble Unator library";

var email = Email.Html(
preheader is not null ? Email.Preview(preheader) : Email.Empty(),
//var email = Email.Html("lang='uk' style='display:none;'",

Email.H1("Hi Jooble"),
// ("style", "display:none;"), ("lang", "uk"), ("disabled")

Email.Link(href: "https://roman-koshchei.github.io/unator", "Best C# utilities")
);
// preheader is not null ? Email.Preview(preheader) : Email.Empty(),

var text = new StringBuilder();
email.RenderText(text);
Console.WriteLine(text.ToString());
Console.WriteLine();
// Email.H1("Hi Jooble"),

var html = new StringBuilder();
email.RenderHtml(html);
Console.WriteLine(html.ToString());
Console.WriteLine();
// Email.Link(href: "https://roman-koshchei.github.io/unator", "Best C# utilities")
//).Style("display:none;").Lang("uk").Attribute("dlr", "blablabla").Flag("disabled");

//var text = new StringBuilder();
//email.RenderText(text);
//Console.WriteLine(text.ToString());
//Console.WriteLine();

//var html = new StringBuilder();
//email.RenderHtml(html);
//Console.WriteLine(html.ToString());
//Console.WriteLine();

//var db = UmbeddedDb.Open("./umbedded");
//if (!db.HasVal)
Expand Down
Loading

0 comments on commit 5294428

Please sign in to comment.