Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/app/ConverterClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const ApiModal = dynamic(() => import('../components/ApiModal'), { ssr: false })
const LegalModal = dynamic(() => import('../components/LegalModal'), { ssr: false });
const RecentSessionsSidebar = dynamic(() => import('../components/RecentSessionsSidebar'), { ssr: false });
const MobileMenu = dynamic(() => import('../components/converter/MobileMenu'), { ssr: false });
const TipSupportCard = dynamic(() => import('../components/converter/TipSupportCard'), { ssr: false });

export default function ConverterClient({ children }) {
const { uiText } = useI18n();
Expand All @@ -54,6 +55,7 @@ export default function ConverterClient({ children }) {
accept={ACCEPT_ATTRIBUTE}
aria-label={uiText("Choose documents to optimize")}
className="hidden"
onClick={vm.tip.cancel}
onChange={(e) => {
if (e.target.files?.length) {
converter.addFiles(e.target.files);
Expand Down Expand Up @@ -167,6 +169,7 @@ export default function ConverterClient({ children }) {
{ui.legalModal && <LegalModal isOpen onClose={ui.closeLegal} initialTab={ui.legalModal} />}

<Toast message={vm.toast} />
{vm.tip.pending && !vm.tip.blocked && <TipSupportCard markShown={vm.tip.markShown} cancel={vm.tip.cancel} dismiss={vm.tip.dismiss} />}
</div>
);
}
4 changes: 4 additions & 0 deletions frontend/components/LLMiserFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export default function LLMiserFooter({
</button>

<button
data-tip-export=""
onClick={onDownloadMd}
disabled={!activeResult}
className="px-4 py-1.5 rounded-full aurora-btn font-sans text-[12.5px] font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed shadow-2xs flex items-center gap-1.5"
Expand All @@ -102,6 +103,7 @@ export default function LLMiserFooter({

{totalConverted > 1 && (
<button
data-tip-export=""
onClick={onDownloadZip}
className="px-3 py-1.5 rounded-full border border-[var(--border-3)] hover:border-[var(--text)] text-[var(--muted)] hover:text-[var(--text)] text-[12px] font-tech cursor-pointer bg-[var(--surface)] transition-colors"
title={uiText("Download all converted documents as .zip")}
Expand Down Expand Up @@ -157,6 +159,7 @@ export default function LLMiserFooter({
)}
<li>
<button
data-tip-export=""
onClick={onDownloadMd}
disabled={!activeResult}
className="hover:text-[var(--text)] transition-colors bg-transparent border-0 p-0 text-[13px] text-[var(--muted)] cursor-pointer disabled:opacity-40"
Expand Down Expand Up @@ -246,6 +249,7 @@ export default function LLMiserFooter({
<div><button onClick={onOpenApi} className="p-0 bg-transparent border-0 text-inherit cursor-pointer">API</button></div>
<div>
<button
data-tip-export=""
onClick={onDownloadMd}
disabled={!activeResult}
className="p-0 bg-transparent border-0 text-inherit cursor-pointer disabled:opacity-40"
Expand Down
1 change: 1 addition & 0 deletions frontend/components/converter/ExportActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function ExportActions({
{style.separated && i > 0 && <span>·</span>}
<button
type="button"
data-tip-export={a.key === 'copy' ? undefined : ''}
onClick={a.onClick}
disabled={a.disabled}
className={`tap-target ${style.button}`}
Expand Down
1 change: 1 addition & 0 deletions frontend/components/converter/ResultOutputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default function ResultOutputs({ result }) {
{reference.outputs.map((output, index) => (
<li key={`${output.name}-${index}`} className="py-1 [overflow-wrap:anywhere]">
<a
data-tip-export=""
href={`/api/jobs/${reference.job_id}/download?output=${encodeURIComponent(output.name)}`}
target="_blank" rel="noopener noreferrer"
className="text-[#2a78d6] dark:text-[#60a5fa] underline"
Expand Down
79 changes: 79 additions & 0 deletions frontend/components/converter/TipSupportCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
'use client';

import { useEffect, useLayoutEffect, useRef, useState } from 'react';
import { useI18n } from '../i18n/I18nContext';
import { TIP_PROMPT } from '../../lib/models/tipPrompt';
import styles from './TipSupportCard.module.css';

const overlaps = (a, b) => a.left < b.right && a.right > b.left && a.top < b.bottom && a.bottom > b.top;

/** Lift the card above any visible export controls it would otherwise cover. */
function placeCard(card) {
card.style.removeProperty('--tip-offset');
const area = card.getBoundingClientRect();
const controls = Array.from(document.querySelectorAll('[data-tip-export]'))
.map(control => control.getBoundingClientRect())
.filter(rect => rect.width && rect.height && rect.bottom > 0 && rect.top < window.innerHeight)
.sort((a, b) => b.top - a.top);
let shift = 0;
for (const control of controls) {
if (overlaps({ left: area.left, right: area.right, top: area.top - shift, bottom: area.bottom - shift }, control)) {
shift = Math.max(shift, area.bottom - control.top + 8);
}
}
if (area.top - shift < 8) return false;
card.style.setProperty('--tip-offset', `${shift}px`);
return true;
}

export default function TipSupportCard({ markShown, cancel, dismiss }) {
const { uiText } = useI18n();
const ref = useRef(null);
const claimed = useRef(false);
const [visible, setVisible] = useState(false);
useLayoutEffect(() => {
const card = ref.current;
if (!placeCard(card) || (!claimed.current && !markShown())) { cancel(); return; }
claimed.current = true;
setVisible(true);
const reposition = () => { if (!placeCard(card)) cancel(); };
const observer = new ResizeObserver(reposition);
observer.observe(card);
window.addEventListener('resize', reposition);
window.addEventListener('scroll', reposition, true);
return () => {
observer.disconnect();
window.removeEventListener('resize', reposition);
window.removeEventListener('scroll', reposition, true);
};
}, [markShown, cancel]);

useEffect(() => {
const escape = event => { if (event.key === 'Escape' && !event.defaultPrevented) dismiss('dismiss'); };
window.addEventListener('keydown', escape);
return () => window.removeEventListener('keydown', escape);
}, [dismiss]);

return (
<aside ref={ref} aria-labelledby="tip-support-title" className={styles.card} style={{ visibility: visible ? 'visible' : 'hidden' }}>
<div className={styles.content}>
<picture>
<source media="(prefers-reduced-motion: reduce)" srcSet="/support/llmiser-tip-banner-static@2x.png" />
{/* The animated GIF is already sized for this card. */}
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src="/support/llmiser-tip-banner.gif" srcSet="/support/llmiser-tip-banner.gif 1x, /support/llmiser-tip-banner@2x.gif 2x" alt="" width="360" height="120" className={styles.banner} />
</picture>
<div className={styles.heading}>
<h2 id="tip-support-title">{uiText('Glad that worked!')}</h2>
<button type="button" aria-label={uiText('Close')} className={styles.close} onClick={() => dismiss('dismiss')}>×</button>
</div>
<p>{uiText('LLMiser is free and runs on a server I pay for. If it saved you time, a small tip helps keep it online.')}</p>
<div className={styles.actions}>
<a className="aurora-btn" href={TIP_PROMPT.url} target="_blank" rel="noopener noreferrer" onClick={() => dismiss('support')}>{uiText('Support on Ko-fi')}</a>
<button type="button" onClick={() => dismiss('dismiss')}>{uiText('Maybe later')}</button>
</div>
<button type="button" className={styles.already} onClick={() => dismiss('already-supported')}>{uiText('I already did')}</button>
</div>
</aside>
);
}
47 changes: 47 additions & 0 deletions frontend/components/converter/TipSupportCard.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.card {
position: fixed;
z-index: 44;
right: 1rem;
bottom: calc(1rem + var(--tip-offset, 0px));
width: min(360px, calc(100vw - 2rem));
max-height: calc(100dvh - 2rem);
overflow: auto;
border: 1px solid var(--border-3);
border-radius: 16px;
background: var(--surface);
color: var(--text);
box-shadow: 0 12px 36px #0003;
text-align: start;
}

.content { padding: 12px; animation: arrive 160ms ease-out; }
.banner { display: block; width: 100%; height: auto; border-radius: 10px; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.heading h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.content p { margin: 0 0 12px; font-size: .875rem; line-height: 1.45; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions a, .actions button, .close, .already {
min-width: 44px;
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 6px 12px;
border-radius: 999px;
font-size: .875rem;
text-decoration: none;
cursor: pointer;
}
.actions a { font-weight: 650; }
.actions button { border: 1px solid var(--border-3); background: var(--surface-2); }
.close { font-size: 1.25rem; }
.already { text-decoration: underline; text-underline-offset: 3px; }
.card :is(a, button):focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

@media (max-width: 639px) {
.card { left: 8px; right: 8px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom) + var(--tip-offset, 0px)); max-height: 45dvh; }
.banner { max-height: 88px; object-fit: contain; }
}

@keyframes arrive { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .content { animation: none; } }
7 changes: 7 additions & 0 deletions frontend/lib/i18n/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,13 @@
"Frequently asked questions": "Häufig gestellte Fragen",
"Full formatted document": "Vollständig formatiertes Dokument",
"GitHub": "GitHub",
"Glad that worked!": "Schön, dass es geklappt hat!",
"Heading-aligned chunks for vector embeddings": "An Überschriften ausgerichtete Abschnitte für Vektoreinbettungen",
"How can document preparation reduce LLM costs?": "Wie kann Dokumentenvorbereitung LLM-Kosten senken?",
"How can document preparation reduce LLM input costs?": "Wie senkt Dokumentenvorbereitung die LLM-Eingabekosten?",
"How do I convert documents with LLMiser?": "Wie konvertiere ich Dokumente mit LLMiser?",
"How does LLMiser help optimize LLM costs?": "Wie hilft LLMiser bei der LLM-Kostenoptimierung?",
"I already did": "Schon unterstützt",
"If a result download fails, you can use its saved reference to request fresh download links without uploading or converting the file again. This sends the conversion reference to our service. Signed download links are not saved in local storage. Server retrieval stops when its files are deleted. Your cached Markdown copy can still be opened after server deletion.": "Wenn ein Ergebnis nicht heruntergeladen werden kann, können Sie mit dem gespeicherten Verweis neue Downloadlinks anfordern, ohne die Datei erneut hochzuladen oder zu konvertieren. Dabei wird der Konvertierungsverweis an unseren Dienst gesendet. Signierte Downloadlinks werden nicht im lokalen Speicher abgelegt. Nach dem Löschen der Dateien ist kein Serverabruf mehr möglich. Ihre zwischengespeicherte Markdown-Kopie lässt sich weiterhin öffnen.",
"If any part of these terms turns out to be invalid, the rest still applies.": "Sollten einzelne Bestimmungen unwirksam sein, bleiben die übrigen gültig.",
"If you have a complaint, write to devbehindyou@gmail.com first. We aim to answer within 14 days.": "Bei Beschwerden schreiben Sie zunächst an devbehindyou@gmail.com. Wir streben eine Antwort innerhalb von 14 Tagen an.",
Expand Down Expand Up @@ -282,6 +284,7 @@
"LLMiser is a free LLM cost optimizer for document inputs. Convert PDFs, Word files, spreadsheets, slides, images and ZIP projects to Markdown, then trim unnecessary context before sending it to an AI assistant or retrieval pipeline.": "LLMiser ist ein kostenloser LLM-Kostenoptimierer für Dokumenteneingaben. Konvertieren Sie PDFs, Word-Dateien, Tabellen, Folien, Bilder und ZIP-Projekte in Markdown und entfernen Sie unnötigen Kontext, bevor Sie ihn an einen KI-Assistenten oder eine Abrufpipeline senden.",
"LLMiser is a free service with no guaranteed uptime. We can change, pause or end all or part of it. Where we reasonably can, we'll announce big changes in advance.": "LLMiser ist kostenlos, ohne garantierte Verfügbarkeit. Wir können den Dienst ganz oder teilweise ändern, aussetzen oder beenden. Größere Änderungen kündigen wir soweit zumutbar vorher an.",
"LLMiser is busy right now. Please try again shortly.": "LLMiser ist gerade ausgelastet. Bitte in Kürze erneut versuchen.",
"LLMiser is free and runs on a server I pay for. If it saved you time, a small tip helps keep it online.": "LLMiser ist kostenlos und läuft auf einem Server, den ich bezahle. Wenn es Ihnen Zeit gespart hat, hilft ein kleines Trinkgeld, den Dienst online zu halten.",
"LLMiser is free. You keep full ownership of your files.": "LLMiser ist kostenlos. Sie behalten alle Eigentumsrechte an Ihren Dateien.",
"LLMiser is provided by DevBehindYou. Contact: devbehindyou@gmail.com.": "LLMiser wird von DevBehindYou bereitgestellt. Kontakt: devbehindyou@gmail.com.",
"LLMiser is run by DevBehindYou. For anything about your data, write to devbehindyou@gmail.com.": "LLMiser wird von DevBehindYou betrieben. Bei Fragen zu Ihren Daten schreiben Sie an devbehindyou@gmail.com.",
Expand Down Expand Up @@ -317,6 +320,7 @@
"Markdown with headings, lists and pipe tables": "Markdown mit Überschriften, Listen und Tabellen",
"Markdown · UTF-8": "Markdown · UTF-8",
"Max 5 sessions stored": "Maximal 5 Konvertierungen gespeichert",
"Maybe later": "Vielleicht später",
"Measure the result for your model": "Ergebnis für Ihr Modell messen",
"Menu": "Menü",
"Minimizes token density": "Reduziert die Tokenanzahl",
Expand Down Expand Up @@ -462,6 +466,7 @@
"Stored files changed. Refresh and try again.": "Die gespeicherten Dateien haben sich geändert. Aktualisieren Sie die Ansicht und versuchen Sie es erneut.",
"Stripped of metadata & extra line breaks": "Ohne Metadaten und zusätzliche Zeilenumbrüche",
"Strips metadata & extra lines": "Entfernt Metadaten und zusätzliche Zeilen",
"Support on Ko-fi": "Auf Ko-fi unterstützen",
"Supported documents and output": "Unterstützte Dokumente und Ausgabe",
"Switch to {v0} mode": "Zum Modus {v0} wechseln",
"Task": "Aufgabe",
Expand All @@ -481,6 +486,7 @@
"The project result is incomplete. Please retry downloading it.": "Das Projektergebnis ist unvollständig. Bitte laden Sie es erneut herunter.",
"The saved result could not be retrieved. Please retry.": "Das gespeicherte Ergebnis konnte nicht abgerufen werden. Bitte versuchen Sie es erneut.",
"The selected jobs have no stored results": "Die ausgewählten Aufträge haben keine gespeicherten Ergebnisse",
"The support prompt stores a local conversion count and timestamps to limit how often it appears.": "Der Unterstützungshinweis speichert lokal die Anzahl der Konvertierungen und Zeitstempel, um seine Anzeigehäufigkeit zu begrenzen.",
"The text in the image, as Markdown": "Der Bildtext als Markdown",
"Theme": "Design",
"Theme:": "Design:",
Expand All @@ -491,6 +497,7 @@
"This saved result is no longer available. Remove this entry and choose the original file to convert it again.": "Dieses gespeicherte Ergebnis ist nicht mehr verfügbar. Entfernen Sie den Eintrag und wählen Sie die Originaldatei für eine neue Konvertierung.",
"This upload reservation expired. Choose the files again.": "Diese Upload-Reservierung ist abgelaufen. Wählen Sie die Dateien erneut aus.",
"Time": "Zeit",
"Tips are made on Ko-fi and processed by its third-party payment provider, and LLMiser may receive supporter details from those services.": "Trinkgeld wird auf Ko-fi gegeben und vom externen Zahlungsanbieter verarbeitet. LLMiser kann von diesen Diensten Angaben zu Unterstützenden erhalten.",
"To report content you believe is illegal, send us: why you think it's illegal, the file name or job reference and the time, your name and email, and a statement that your report is accurate and made in good faith. We'll review it without undue delay and tell you what we decided. If we restrict content or access, we explain the reason to the person affected.": "Für eine Meldung nennen Sie den vermuteten Rechtsverstoß, Dateinamen oder Auftragsreferenz und Zeitpunkt, Ihren Namen und Ihre E-Mail sowie eine Erklärung, dass die Meldung richtig und nach bestem Wissen erfolgt. Wir prüfen sie unverzüglich und teilen die Entscheidung mit. Bei Inhalts- oder Zugangsbeschränkungen erklären wir betroffenen Personen die Gründe.",
"Toggle Recent Conversion Sessions Sidebar": "Seitenleiste mit letzten Konvertierungen umschalten",
"Toggle Recent Conversion Sessions Sidebar (⌘B)": "Seitenleiste mit letzten Konvertierungen umschalten (⌘B)",
Expand Down
Loading
Loading