mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-23 18:01:26 +01:00
refactor: signin landing page
This commit is contained in:
@@ -29,11 +29,11 @@ pub async fn show_signin_form(
|
||||
}
|
||||
match boosted {
|
||||
true => Ok(TemplateResponse::new_partial(
|
||||
"auth/signin_form.html",
|
||||
"auth/signin_base.html",
|
||||
"body",
|
||||
(),
|
||||
)),
|
||||
false => Ok(TemplateResponse::new_template("auth/signin_form.html", ())),
|
||||
false => Ok(TemplateResponse::new_template("auth/signin_base.html", ())),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::{
|
||||
auth_middleware::RequireUser,
|
||||
response_middleware::{HtmlError, TemplateResponse},
|
||||
},
|
||||
AuthSessionType, SessionType,
|
||||
AuthSessionType,
|
||||
};
|
||||
use common::{
|
||||
error::AppError,
|
||||
@@ -25,7 +25,6 @@ use crate::html_state::HtmlState;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct IndexPageData {
|
||||
gdpr_accepted: bool,
|
||||
user: Option<User>,
|
||||
latest_text_contents: Vec<TextContent>,
|
||||
active_jobs: Vec<IngestionTask>,
|
||||
@@ -34,34 +33,26 @@ pub struct IndexPageData {
|
||||
pub async fn index_handler(
|
||||
State(state): State<HtmlState>,
|
||||
auth: AuthSessionType,
|
||||
session: SessionType,
|
||||
) -> Result<impl IntoResponse, HtmlError> {
|
||||
let gdpr_accepted = auth.current_user.is_some() | session.get("gdpr_accepted").unwrap_or(false);
|
||||
|
||||
let active_jobs = match auth.current_user.is_some() {
|
||||
true => {
|
||||
User::get_unfinished_ingestion_tasks(&auth.current_user.clone().unwrap().id, &state.db)
|
||||
.await?
|
||||
}
|
||||
false => vec![],
|
||||
let Some(user) = auth.current_user else {
|
||||
return Ok(TemplateResponse::new_template(
|
||||
"index/index.html",
|
||||
IndexPageData {
|
||||
user: None,
|
||||
latest_text_contents: vec![],
|
||||
active_jobs: vec![],
|
||||
},
|
||||
));
|
||||
};
|
||||
|
||||
let latest_text_contents = match auth.current_user.clone().is_some() {
|
||||
true => {
|
||||
User::get_latest_text_contents(
|
||||
auth.current_user.clone().unwrap().id.as_str(),
|
||||
&state.db,
|
||||
)
|
||||
.await?
|
||||
}
|
||||
false => vec![],
|
||||
};
|
||||
let active_jobs = User::get_unfinished_ingestion_tasks(&user.id, &state.db).await?;
|
||||
|
||||
let latest_text_contents = User::get_latest_text_contents(user.id.as_str(), &state.db).await?;
|
||||
|
||||
Ok(TemplateResponse::new_template(
|
||||
"index/index.html",
|
||||
IndexPageData {
|
||||
gdpr_accepted,
|
||||
user: auth.current_user,
|
||||
user: Some(user),
|
||||
latest_text_contents,
|
||||
active_jobs,
|
||||
},
|
||||
|
||||
@@ -25,19 +25,23 @@
|
||||
|
||||
<!-- Settings in Fieldset -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
||||
<fieldset class="fieldset p-4 shadow rounded-box">
|
||||
<legend class="fieldset-legend">Registration</legend>
|
||||
<label class="fieldset-label">
|
||||
{% block registration_status_input %}
|
||||
<form hx-patch="/toggle-registrations" hx-swap="outerHTML" hx-trigger="change">
|
||||
<input name="registration_open" type="checkbox" class="checkbox" {% if settings.registrations_enabled
|
||||
%}checked{% endif %} />
|
||||
</form>
|
||||
{% endblock %}
|
||||
Enable Registrations
|
||||
</label>
|
||||
<div id="registration-status" class="text-sm mt-2"></div>
|
||||
</fieldset>
|
||||
{% block system_prompt_section %}
|
||||
<div id="system_prompt_section">
|
||||
<fieldset class="fieldset p-4 shadow rounded-box">
|
||||
<legend class="fieldset-legend">System Prompts</legend>
|
||||
<div class="flex gap-2 flex-col sm:flex-row">
|
||||
<button type="button" class="btn btn-primary btn-sm" hx-get="/edit-query-prompt" hx-target="#modal"
|
||||
hx-swap="innerHTML">
|
||||
Edit Query Prompt
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" hx-get="/edit-ingestion-prompt" hx-target="#modal"
|
||||
hx-swap="innerHTML">
|
||||
Edit Ingestion Prompt
|
||||
</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
<fieldset class="fieldset p-4 shadow rounded-box">
|
||||
<legend class="fieldset-legend">AI Models</legend>
|
||||
@@ -76,23 +80,20 @@
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
||||
{% block system_prompt_section %}
|
||||
<div id="system_prompt_section">
|
||||
<fieldset class="fieldset p-4 shadow rounded-box">
|
||||
<legend class="fieldset-legend">System Prompts</legend>
|
||||
<div class="flex gap-2 flex-col sm:flex-row">
|
||||
<button type="button" class="btn btn-primary btn-sm" hx-get="/edit-query-prompt" hx-target="#modal"
|
||||
hx-swap="innerHTML">
|
||||
Edit Query Prompt
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" hx-get="/edit-ingestion-prompt" hx-target="#modal"
|
||||
hx-swap="innerHTML">
|
||||
Edit Ingestion Prompt
|
||||
</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{% endblock %}
|
||||
<fieldset class="fieldset p-4 shadow rounded-box">
|
||||
<legend class="fieldset-legend">Registration</legend>
|
||||
<label class="flex gap-4 text-center">
|
||||
{% block registration_status_input %}
|
||||
<form hx-patch="/toggle-registrations" hx-swap="outerHTML" hx-trigger="change">
|
||||
<input name="registration_open" type="checkbox" class="checkbox" {% if settings.registrations_enabled
|
||||
%}checked{% endif %} />
|
||||
</form>
|
||||
{% endblock %}
|
||||
Enable Registrations
|
||||
</label>
|
||||
<div id="registration-status" class="text-sm mt-2"></div>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
6
crates/html-router/templates/auth/signin_base.html
Normal file
6
crates/html-router/templates/auth/signin_base.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "head_base.html" %}
|
||||
{% block body %}
|
||||
<div class="min-h-[100dvh] flex">
|
||||
{% include "auth/signin_form.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,12 +1,10 @@
|
||||
{% extends "head_base.html" %}
|
||||
{% block body %}
|
||||
<style>
|
||||
form.htmx-request {
|
||||
opacity: 0.5;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="min-h-[100dvh] container mx-auto px-4 sm:px-0 sm:max-w-md flex justify-center flex-col">
|
||||
<div class="flex justify-center grow container mx-auto px-4 sm:px-0 sm:max-w-md flex justify-center flex-col">
|
||||
<h1
|
||||
class="text-5xl sm:text-6xl py-4 pt-10 font-bold bg-linear-to-r from-primary to-secondary text-center text-transparent bg-clip-text">
|
||||
Minne
|
||||
@@ -51,5 +49,4 @@
|
||||
Don't have an account?
|
||||
<a href="/signup" hx-boost="true" class="link link-primary">Sign up</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
@@ -1,15 +0,0 @@
|
||||
<div id="gdpr-banner" class="fixed inset-x-0 mx-auto card max-w-(--breakpoint-sm) mb-2 bg-base-200 bottom-0">
|
||||
<div class="card-body items-center text-center">
|
||||
<p class="text-sm text-base-content"> We use cookies to enhance your experience. By continuing to visit this site,
|
||||
you agree to
|
||||
our use cookies.
|
||||
<a href="/documentation/privacy-policy" class="link link-primary">Learn more</a>
|
||||
</p>
|
||||
<div class="card-actions justify-end mt-2">
|
||||
<button class="btn btn-outline btn-sm text-base-content" hx-post="/gdpr/deny" hx-target="#gdpr-banner"
|
||||
hx-swap="outerHTML">Deny</button>
|
||||
<button class="btn btn-primary btn-sm" hx-post="/gdpr/accept" hx-target="#gdpr-banner"
|
||||
hx-swap="outerHTML">Accept</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,51 +0,0 @@
|
||||
<main class="hero grow flex justify-center ">
|
||||
<div class="container hero-content text-center">
|
||||
<div class="space-y-8">
|
||||
<!-- Hero Section -->
|
||||
<h1
|
||||
class="text-5xl sm:text-6xl py-4 pt-10 font-extrabold bg-linear-to-r from-primary to-secondary text-transparent bg-clip-text font-satoshi">
|
||||
Your Second Brain, Built to Remember
|
||||
<div class="text-xl font-light mt-4">
|
||||
Minne <span class="text-base-content opacity-70">/ˈmɪnɛ/ [Swedish: memory]</span>
|
||||
</div>
|
||||
</h1>
|
||||
<p class="text-xl ">
|
||||
Capture, connect, and retrieve your knowledge effortlessly with Minne
|
||||
</p>
|
||||
|
||||
<!-- Features Grid -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 my-12">
|
||||
<div class="card bg-base-100 shadow-hover">
|
||||
<div class="card-body items-center">
|
||||
<div class="skeleton h-32 w-32 rounded-full"></div>
|
||||
<h3 class="card-title text-xl">Easy Capture</h3>
|
||||
<p>Save anything instantly - texts, links, images, and more</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card bg-base-100 shadow-hover">
|
||||
<div class="card-body items-center">
|
||||
<div class="skeleton h-32 w-32 rounded-full"></div>
|
||||
<h3 class="card-title text-xl">Smart Analysis</h3>
|
||||
<p>AI-powered content analysis and organization</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card bg-base-100 shadow-hover">
|
||||
<div class="card-body items-center">
|
||||
<div class="skeleton h-32 w-32 rounded-full"></div>
|
||||
<h3 class="card-title text-xl">Knowledge Graph</h3>
|
||||
<p>Visualize connections between your ideas</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CTA -->
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-center gap-4">
|
||||
<a class="btn btn-primary btn-lg" hx-boost="true" href="/signup">Get Started</a>
|
||||
<a class="btn btn-outline btn-lg" hx-boost="true" href="/documentation">Learn More</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
@@ -3,9 +3,6 @@
|
||||
{% if user %}
|
||||
{% include 'index/signed_in/base.html' %}
|
||||
{% else %}
|
||||
{% include 'index/hero.html' %}
|
||||
{% if not gdpr_accepted %}
|
||||
{% include "gdpr.html" %}
|
||||
{% endif %}
|
||||
{% include 'auth/signin_form.html' %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
4
todo.md
4
todo.md
@@ -2,9 +2,10 @@
|
||||
\[\] configs primarily get envs
|
||||
\[\] filtering on categories
|
||||
\[\] integrate assets folder in release build
|
||||
\[x] integrate templates in release build
|
||||
\[\] make sure error messages render correctly
|
||||
\[\] markdown rendering in client
|
||||
\[\] openai api key in config
|
||||
\[\] testing core functions
|
||||
\[\] three js graph explorer
|
||||
\[\] three js vector explorer
|
||||
\[x\] add user_id to ingress objects
|
||||
@@ -16,6 +17,7 @@
|
||||
\[x\] gdpr
|
||||
\[x\] html ingression
|
||||
\[x\] hx-redirect
|
||||
\[x\] integrate templates in release build
|
||||
\[x\] ios shortcut generation
|
||||
\[x\] job queue
|
||||
\[x\] link to ingressed urls or archives
|
||||
|
||||
Reference in New Issue
Block a user