mirror of
https://github.com/caddyserver/website.git
synced 2025-04-20 12:15:08 -04:00

* Initial commit; starting new design Dropdown menu * Begin docs layout of new design * Get themes under control; button hover splash * Some basic responsiveness * Finish responsive layout; several bug fixes * Avoid flash during color scheme change * Begin building top of homepage * docs: Start building quick-assist feature * Work on homepage a little more * Keep working on homepage * More homepage progress * Some sponsor SVGs * Add sponsor features * Implement basic Sponsor Experience box * Reorganize some styles * WIP sponsors page * Start features page WIP * Minor improvements * Fix headings; work on features page * WIP features page * Continue work on marketing pages * Continue work on features page * More features WIP * Continue features page... * More work on features page * Keeping going :) * Continue home and features pages * More homepage/features content, screenshots, tweaks * Minor fixes to features page * Minor tweaks * Work on testimonials * Work on homepage more * More homepage work * Continue work on homepage * Add some sponsor logos * Some citation screenshots * Add citations * Start making homepage responsive * Re-add cache busting Fix docs * Use markdown syntax highlighting on frontpage * Rework AJQuery to $_ to not interfere with jQuery * Rewrite quick assist with AlpineJS, use markdown for contents * More work on marketing pages * Rebase and fix code displays * Syntax highlight on-demand example, fix rollover * Adjust on-demand demo * Work on responsiveness * Keep working on responsiveness * Mainly finish making design responsive * Thiccer favicon * More work on marketing pages * Keep on going * Fix link * Move new site into src folder * Add open graph image * Add recorded demo for homepage * Tweak caption * Fix Poppins font for now * Minor tweaks * Trim demo ending * Remove unfinished pages Also update Framer logo --------- Co-authored-by: Francis Lavoie <lavofr@gmail.com>
103 lines
2.6 KiB
HTML
103 lines
2.6 KiB
HTML
{{ include "/includes/quick-assist/structure.html" }}
|
|
<script>
|
|
document.addEventListener('alpine:init', () => {
|
|
Alpine.data('quick_assist', () => ({
|
|
current: 'start',
|
|
crumbs: [],
|
|
structure: quickAssistStructure,
|
|
|
|
getQuestion() {
|
|
const data = this.structure[this.current];
|
|
return data ? (data.title ?? data.prompt) : "";
|
|
},
|
|
getContent() {
|
|
const content = document.getElementById(`qa-content-${this.current}`);
|
|
return content ? content.innerHTML : "";
|
|
},
|
|
getOptions() {
|
|
const data = this.structure[this.current];
|
|
return data ? (data.options ?? []) : [];
|
|
},
|
|
hasNext() {
|
|
return this.getOptions().some(opt => opt.next);
|
|
},
|
|
crumbTitle(crumb) {
|
|
if (crumb.title) {
|
|
return crumb.title;
|
|
}
|
|
const data = this.structure[crumb.id];
|
|
return data ? (data.title ?? data.prompt) : "";
|
|
},
|
|
goto(next, title = null) {
|
|
if (!next) return true;
|
|
|
|
// Do nothing if last crumb is the same as the next state
|
|
const count = this.crumbs.length;
|
|
if (count && this.crumbs[count - 1].id === next) return true;
|
|
|
|
// Change the page
|
|
this.current = next;
|
|
|
|
// Read backwards through the crumbs and if we find it pop everything after it
|
|
for (let i = count - 1; i >= 0; i--) {
|
|
if (this.crumbs[i].id === next) {
|
|
this.crumbs.splice(i + 1);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Insert the crumb
|
|
this.crumbs.push({ id: next, title: title });
|
|
return false;
|
|
},
|
|
reset() {
|
|
this.current = 'start';
|
|
this.crumbs = [];
|
|
}
|
|
}));
|
|
});
|
|
</script>
|
|
|
|
<div x-data="quick_assist" class="box box-filled box-capped quick-assist">
|
|
<div class="box-cap quick-assist-history">
|
|
<a title="Click quick for slick trick (not AI)" @click="reset()">Quick Assist</a>
|
|
<template x-for="crumb in crumbs">
|
|
<a x-text="crumbTitle(crumb)" @click="goto(crumb.id)" />
|
|
</template>
|
|
</div>
|
|
<div>
|
|
<h3 class="quick-assist-question" x-text="getQuestion()"></h3>
|
|
<div class="quick-assist-content" x-html="getContent()"></div>
|
|
<div class="quick-assist-options">
|
|
<template x-for="opt in getOptions()">
|
|
<div>
|
|
<a
|
|
x-show="opt.href ?? false"
|
|
:href="opt.href"
|
|
x-text="opt.text ?? ''"
|
|
class="button reset"
|
|
/>
|
|
<a
|
|
x-show="!opt.href"
|
|
@click.prevent="goto(opt.next, opt.crumb ?? opt.text)"
|
|
x-text="opt.text ?? ''"
|
|
class="button reset"
|
|
/>
|
|
</div>
|
|
</template>
|
|
<a
|
|
x-show="!hasNext()"
|
|
@click="reset()"
|
|
class="button reset"
|
|
>
|
|
Reset
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- All the markdown content is hidden by default and loaded by ID -->
|
|
<div style="display: none;">
|
|
{{ markdown (include "/includes/quick-assist/content.md") }}
|
|
</div>
|