doc: remove unnecessary contents

This commit is contained in:
2025-10-29 16:29:35 +01:00
parent 5227a33d0a
commit dd859dfaa1
5 changed files with 73 additions and 8 deletions

View File

@@ -10,11 +10,3 @@ It contains information about me and my projects as well as blog entries about s
## zterm
This tui application also serves as an example implementation of the [zterm](https://gitea.yves-biener.de/yves-biener/zterm) library.
---
## Open tasks
- [ ] Improve navigation
- [ ] Have clickable/navigatable links inside of the tui application
- [ ] Launch simple http server alongside tui application

3
doc/about.md Normal file
View File

@@ -0,0 +1,3 @@
# About
Hi, I'm Yves. I'm a developer who <3 the terminal and everything around text interfaces.

5
doc/blog.md Normal file
View File

@@ -0,0 +1,5 @@
# Blog
This is the main entry page for my blog. I plan on writing on things I feel like worth sharing, mentioning for other developers, tinkers like me.
The blog is currently a work in progress and will be updated once a first version of the tui website supports more dynamic contents.

59
src/content.zig Normal file
View File

@@ -0,0 +1,59 @@
pub fn Content(App: type) type {
return struct {
pub fn init(allocator: Allocator) @This() {
_ = allocator;
return .{};
}
pub fn element(this: *@This()) App.Element {
return .{
.ptr = this,
.vtable = &.{
.handle = handle,
.content = content,
},
};
}
fn handle(ctx: *anyopaque, model: *App.Model, event: App.Event) !void {
_ = ctx;
switch (event) {
.about => model.page = .about,
.blog => model.page = .blog,
else => {},
}
}
fn content(ctx: *anyopaque, model: *const App.Model, cells: []zterm.Cell, size: zterm.Point) !void {
_ = ctx;
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
const text = switch (model.page) {
.about => @embedFile("about"),
.blog => @embedFile("blog"),
};
var index: usize = 0;
for (0..size.y) |row| {
for (0..size.x) |col| {
const cell = row * size.x + col;
assert(cell < cells.len);
if (index == text.len) return;
const cp = text[index];
index += 1;
cells[cell].cp = switch (cp) {
'\n' => break,
else => cp,
};
}
}
}
};
}
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const zterm = @import("zterm");

6
src/model.zig Normal file
View File

@@ -0,0 +1,6 @@
page: Pages = .blog,
const Pages = enum {
about,
blog,
};