Skip to content

Commit

Permalink
Feedback option (#17)
Browse files Browse the repository at this point in the history
* added feedback submission

* updated version

* added buttons to settings
  • Loading branch information
JakePIXL committed Nov 10, 2023
1 parent 53f7622 commit 87d9f5a
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion teller/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "teller"
version = "0.2.0"
version = "0.2.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion teller_desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "teller_desktop"
version = "0.2.0"
version = "0.2.1"
description = "Teller is a Minecraft world backup tool, for use with the ChunkVault ecosystem."
authors = ["Valink Solutions"]
license = ""
Expand Down
6 changes: 2 additions & 4 deletions teller_desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "ChunkVault",
"version": "0.2.0"
"version": "0.2.1"
},
"tauri": {
"allowlist": {
Expand Down Expand Up @@ -67,9 +67,7 @@
},
"updater": {
"active": true,
"endpoints": [
"https://releases.chunkvault.com/{{target}}/{{arch}}/{{current_version}}"
],
"endpoints": ["https://releases.chunkvault.com/{{target}}/{{arch}}/{{current_version}}"],
"dialog": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEVDRUEzMDZBRjhEMjdGNTgKUldSWWY5TDRhakRxN0xMS1FmZ3Y2MFpuRXo0Q0RuaHRlbDYvKzR2dkdmcVhpZWF1ZTV0VU44c2cK"
},
Expand Down
8 changes: 6 additions & 2 deletions teller_desktop/src/app.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,19 @@ body {
}

[data-theme='neubrutalism'] .input,
[data-theme='neubrutalism'] .input:focus {
[data-theme='neubrutalism'] .input:focus,
[data-theme='neubrutalism'] .textarea,
[data-theme='neubrutalism'] .textarea:focus {
border-width: 4px;
border-color: black !important;
box-shadow: 0px 4px 0px 0px rgba(0, 0, 0, 1);
outline: none;
}

[data-theme='neubrutalism-dark'] .input,
[data-theme='neubrutalism-dark'] .input:focus {
[data-theme='neubrutalism-dark'] .input:focus,
[data-theme='neubrutalism-dark'] .textarea,
[data-theme='neubrutalism-dark'] .textarea:focus {
border-width: 4px;
border-color: rgba(61, 66, 77, 1) !important;
box-shadow: 0px 4px 0px 0px rgba(61, 66, 77, 1);
Expand Down
116 changes: 116 additions & 0 deletions teller_desktop/src/lib/modals/feedback_modal.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<script lang="ts">
import { onMount } from 'svelte';
import { closeModal, modals } from 'svelte-modals';
import { toast } from '@zerodevx/svelte-toast';
import { canSubmit, logSubmissionTime } from '$lib/stores/feedback';
export let isOpen: boolean;
let stackIndex: number = $modals.length;
let feedbackText: string = '';
let urgency: number = 0;
let canSub: boolean = true;
function updateUrgency(urgen: number) {
if (urgency === urgen) {
urgency = 0;
} else {
urgency = urgen;
}
}
async function submitFeedback() {
if (!$canSubmit) {
toast.push('Please wait for 5 minutes before submitting new feedback.', {
theme: {
'--toastBackground': '#f44336',
'--toastProgressBackground': '#d32f2f'
}
});
return;
}
logSubmissionTime();
const response = await fetch('https://feedback-api.shuttleapp.rs/feedback', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: feedbackText,
urgency: urgency
})
});
if (response.ok) {
toast.push('Feedback submitted!');
closeModal();
} else {
toast.push(await response.text(), {
theme: {
'--toastBackground': '#f44336',
'--toastProgressBackground': '#d32f2f'
}
});
}
}
</script>

{#if isOpen}
<div role="dialog" class="fixed inset-0 flex items-center justify-center z-50">
<div
class="card bg-slate-100 h-fit w-full min-w-[25rem] max-w-[66.666667%] max-h-[85%] overflow-auto"
>
<div class="card-body gap-4">
<h2 class="card-title">Submit Feedback</h2>
<p>Feel free to submit suggestions or report bugs.</p>

<form>
<textarea class="textarea w-full" placeholder="Feedback" bind:value={feedbackText} />

<div class="flex justify-between">
<button
class={urgency === 10 ? 'btn btn-primary' : 'btn btn-outline'}
on:click={() => updateUrgency(10)}>&#128556; Commend</button
>
<button
class={urgency === 20 ? 'btn btn-primary' : 'btn btn-outline'}
on:click={() => updateUrgency(20)}>&#128375; Bug</button
>
<button
class={urgency === 30 ? 'btn btn-primary' : 'btn btn-outline'}
on:click={() => updateUrgency(30)}>&#128640; Feature</button
>
<button
class={urgency === 50 ? 'btn btn-error' : 'btn btn-outline'}
on:click={() => updateUrgency(50)}>&#128163; URGENT</button
>
</div>
</form>

<div class="justify-between items-center card-actions">
<a
class="link text-sm"
target="_blank"
href="https://github.com/Valink-Solutions/teller/issues"
>Submit more info in a github issue.</a
>

<div class="flex flex-row gap-2">
{#if stackIndex > 1}
<button on:click={closeModal} class="btn">Close</button>
{:else}
<button on:click={closeModal} class="btn">Close</button>
{/if}

<button on:click={submitFeedback} class="btn btn-primary" disabled={!$canSubmit}
>Submit</button
>
</div>
</div>
</div>
</div>
</div>
{/if}
19 changes: 18 additions & 1 deletion teller_desktop/src/lib/modals/settings_modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,24 @@
</div>
</div>

<div class="justify-end card-actions">
<div class="justify-between items-center card-actions">
<div class="flex flex-row">
<a href="https://ko-fi.com/jakepixl" target="_blank" class="btn btn-ghost btn-square">
<Icon icon="simple-icons:kofi" class="h-6 w-6" />
</a>

<a href="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/Valink-Solutions/teller" target="_blank" class="btn btn-ghost btn-square">
<Icon icon="mdi:github" class="h-6 w-6" />
</a>

<a href="https://discord.gg/k3yjVarAtA" target="_blank" class="btn btn-ghost btn-square">
<Icon icon="mdi:discord" class="h-6 w-6" />
</a>

<a href="https://docs.chunkvault.com" target="_blank" class="btn btn-ghost btn-square">
<Icon icon="material-symbols:docs" class="h-6 w-6" />
</a>
</div>
{#if stackIndex > 1}
<button on:click={closeModal} class="btn">Close</button>
{:else}
Expand Down
13 changes: 13 additions & 0 deletions teller_desktop/src/lib/stores/feedback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { writable, derived } from 'svelte/store';

const lastFeedbackTime = writable(0);
const timeLimit = 300000; // 5 minutes in milliseconds

export const canSubmit = derived(lastFeedbackTime, ($lastFeedbackTime) => {
const now = Date.now();
return now - $lastFeedbackTime >= timeLimit;
});

export function logSubmissionTime() {
lastFeedbackTime.set(Date.now());
}
9 changes: 9 additions & 0 deletions teller_desktop/src/routes/local/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import type { DirectorySettings } from '$lib/types/config';
import type { BackupSettings } from '$lib/types/backups';
import type { ToastEvent } from '$lib/types/events';
import FeedbackModal from '$lib/modals/feedback_modal.svelte';
let sideBar: HTMLElement | null = null;
Expand Down Expand Up @@ -249,6 +250,14 @@
{/if}
</div>
</div>

<button
on:click={() => openModal(FeedbackModal)}
class="absolute bottom-2 left-2 btn btn-sm btn-ghost gap-1"
>
<Icon icon="mdi:feedback" />
Feedback
</button>
</div>
</div>

Expand Down

0 comments on commit 87d9f5a

Please sign in to comment.