mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
frontend: some changes
This commit is contained in:
21
Cargo.lock
generated
21
Cargo.lock
generated
@@ -407,6 +407,8 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"serde_yaml",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2673,6 +2675,19 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_yaml"
|
||||||
|
version = "0.9.34+deprecated"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
|
||||||
|
dependencies = [
|
||||||
|
"indexmap 2.6.0",
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
"unsafe-libyaml",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha1"
|
name = "sha1"
|
||||||
version = "0.10.6"
|
version = "0.10.6"
|
||||||
@@ -3476,6 +3491,12 @@ dependencies = [
|
|||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unsafe-libyaml"
|
||||||
|
version = "0.2.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "2.5.2"
|
version = "2.5.2"
|
||||||
|
|||||||
51
Cargo.toml
51
Cargo.toml
@@ -39,19 +39,19 @@ rstest = "0.23"
|
|||||||
rstest_reuse = "0.7"
|
rstest_reuse = "0.7"
|
||||||
sha2 = "0.10"
|
sha2 = "0.10"
|
||||||
tokio = { version = "1", features = [
|
tokio = { version = "1", features = [
|
||||||
"net",
|
"net",
|
||||||
"tracing",
|
"tracing",
|
||||||
"macros",
|
"macros",
|
||||||
"rt-multi-thread",
|
"rt-multi-thread",
|
||||||
"full",
|
"full",
|
||||||
] }
|
] }
|
||||||
url = "2.5"
|
url = "2.5"
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
quick-xml = { version = "0.37", features = [
|
quick-xml = { version = "0.37", features = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde-types",
|
"serde-types",
|
||||||
"serialize",
|
"serialize",
|
||||||
] }
|
] }
|
||||||
rust-embed = "8.5"
|
rust-embed = "8.5"
|
||||||
futures-core = "0.3.31"
|
futures-core = "0.3.31"
|
||||||
@@ -61,21 +61,26 @@ itertools = "0.13"
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
strum = { version = "0.26", features = ["strum_macros", "derive"] }
|
strum = { version = "0.26", features = ["strum_macros", "derive"] }
|
||||||
derive_more = { version = "1.0", features = [
|
derive_more = { version = "1.0", features = [
|
||||||
"from",
|
"from",
|
||||||
"try_into",
|
"try_into",
|
||||||
"into",
|
"into",
|
||||||
"deref",
|
"deref",
|
||||||
|
] }
|
||||||
|
askama = { version = "0.12", features = [
|
||||||
|
"serde",
|
||||||
|
"with-actix-web",
|
||||||
|
"serde-json",
|
||||||
|
"serde-yaml",
|
||||||
] }
|
] }
|
||||||
askama = { version = "0.12", features = ["serde", "with-actix-web"] }
|
|
||||||
askama_actix = "0.14"
|
askama_actix = "0.14"
|
||||||
sqlx = { version = "0.8", default-features = false, features = [
|
sqlx = { version = "0.8", default-features = false, features = [
|
||||||
"sqlx-sqlite",
|
"sqlx-sqlite",
|
||||||
"uuid",
|
"uuid",
|
||||||
"chrono",
|
"chrono",
|
||||||
"sqlite",
|
"sqlite",
|
||||||
"runtime-tokio",
|
"runtime-tokio",
|
||||||
"macros",
|
"macros",
|
||||||
"migrate",
|
"migrate",
|
||||||
] }
|
] }
|
||||||
ical = { version = "0.11", features = ["generator", "serde"] }
|
ical = { version = "0.11", features = ["generator", "serde"] }
|
||||||
toml = "0.8"
|
toml = "0.8"
|
||||||
@@ -115,9 +120,9 @@ opentelemetry_sdk = { version = "0.26", features = ["rt-tokio"] }
|
|||||||
opentelemetry-semantic-conventions = "0.26"
|
opentelemetry-semantic-conventions = "0.26"
|
||||||
tracing-opentelemetry = "0.27"
|
tracing-opentelemetry = "0.27"
|
||||||
tracing-subscriber = { version = "0.3", features = [
|
tracing-subscriber = { version = "0.3", features = [
|
||||||
"env-filter",
|
"env-filter",
|
||||||
"fmt",
|
"fmt",
|
||||||
"registry",
|
"registry",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ repository.workspace = true
|
|||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
askama = { workspace = true }
|
askama.workspace = true
|
||||||
askama_actix = { workspace = true }
|
askama_actix = { workspace = true }
|
||||||
actix-session = { workspace = true }
|
actix-session = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
|||||||
3
crates/frontend/public/assets/style.css
Normal file
3
crates/frontend/public/assets/style.css
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>{% block title %}RustiCal{% endblock %}</title>
|
<title>{% block title %}RustiCal{% endblock %}</title>
|
||||||
|
<link rel="stylesheet" href="/frontend/assets/style.css" />
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Test</h1>
|
{% let name = addressbook.displayname.to_owned().unwrap_or(addressbook.id.to_owned()) %}
|
||||||
<a href="/frontend/user/{{ owner }}">Back</a>
|
<h1>{{ name }}</h1>
|
||||||
|
{% if let Some(description) = addressbook.description %}<p>{{ description }}</p>{% endif%}
|
||||||
|
|
||||||
|
<pre>{{ addressbook|yaml }}</pre>
|
||||||
|
|
||||||
|
<a href="/frontend/user/{{ addressbook.principal }}">Back</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Test</h1>
|
{% let name = calendar.displayname.to_owned().unwrap_or(calendar.id.to_owned()) %}
|
||||||
|
<h1>{{ name }}</h1>
|
||||||
|
{% if let Some(description) = calendar.description %}<p>{{ description }}</p>{% endif%}
|
||||||
|
|
||||||
|
<pre>{{ calendar|yaml }}</pre>
|
||||||
|
|
||||||
<a href="/frontend/user/{{ calendar.principal }}">Back</a>
|
<a href="/frontend/user/{{ calendar.principal }}">Back</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -48,6 +48,23 @@ li.collection-list-item {
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{%if !deleted_calendars.is_empty() %}
|
||||||
|
<h3>Deleted Calendars</h3>
|
||||||
|
<ul>
|
||||||
|
{% for calendar in deleted_calendars %}
|
||||||
|
{% let color = calendar.color.to_owned().unwrap_or("red".to_owned()) %}
|
||||||
|
<li class="collection-list-item" style="--color: {{ color }}">
|
||||||
|
<a href="/frontend/user/{{ user_id }}/calendar/{{ calendar.id}}">
|
||||||
|
<span class="title">{{ calendar.displayname.to_owned().unwrap_or(calendar.id.to_owned()) }}</span>
|
||||||
|
<span class="description">
|
||||||
|
{% if let Some(description) = calendar.description %}{{ description }}{% endif %}
|
||||||
|
</span>
|
||||||
|
<div class="color-chip"></div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h2>Addressbooks</h2>
|
<h2>Addressbooks</h2>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -62,5 +79,20 @@ li.collection-list-item {
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{%if !deleted_addressbooks.is_empty() %}
|
||||||
|
<h3>Deleted Addressbooks</h3>
|
||||||
|
<ul>
|
||||||
|
{% for addressbook in deleted_addressbooks %}
|
||||||
|
<li class="collection-list-item">
|
||||||
|
<a href="/frontend/user/{{ user_id }}/addressbook/{{ addressbook.id}}">
|
||||||
|
<span class="title">{{ addressbook.displayname.to_owned().unwrap_or(addressbook.id.to_owned()) }}</span>
|
||||||
|
<span class="description">
|
||||||
|
{% if let Some(description) = addressbook.description %}{{ description }}{% endif %}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ pub use config::FrontendConfig;
|
|||||||
struct UserPage {
|
struct UserPage {
|
||||||
pub user_id: String,
|
pub user_id: String,
|
||||||
pub calendars: Vec<Calendar>,
|
pub calendars: Vec<Calendar>,
|
||||||
|
pub deleted_calendars: Vec<Calendar>,
|
||||||
pub addressbooks: Vec<Addressbook>,
|
pub addressbooks: Vec<Addressbook>,
|
||||||
|
pub deleted_addressbooks: Vec<Addressbook>,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn route_user<CS: CalendarStore + ?Sized, AS: AddressbookStore + ?Sized>(
|
async fn route_user<CS: CalendarStore + ?Sized, AS: AddressbookStore + ?Sized>(
|
||||||
@@ -47,7 +49,9 @@ async fn route_user<CS: CalendarStore + ?Sized, AS: AddressbookStore + ?Sized>(
|
|||||||
|
|
||||||
UserPage {
|
UserPage {
|
||||||
calendars: cal_store.get_calendars(&user.id).await.unwrap(),
|
calendars: cal_store.get_calendars(&user.id).await.unwrap(),
|
||||||
|
deleted_calendars: cal_store.get_deleted_calendars(&user.id).await.unwrap(),
|
||||||
addressbooks: addr_store.get_addressbooks(&user.id).await.unwrap(),
|
addressbooks: addr_store.get_addressbooks(&user.id).await.unwrap(),
|
||||||
|
deleted_addressbooks: addr_store.get_deleted_addressbooks(&user.id).await.unwrap(),
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
}
|
}
|
||||||
.to_response()
|
.to_response()
|
||||||
|
|||||||
Reference in New Issue
Block a user