Create a standard copy button component and remove a lot of redundant code
This commit is contained in:
@@ -20,9 +20,9 @@ import Speedtest from "./Speedtest.svelte";
|
||||
</p>
|
||||
<p>
|
||||
The speed measured is the maximum speed reached for two continuous
|
||||
seconds during the test. The normal test has a time limit of 15
|
||||
seconds during the test. The normal test has a time limit of 12
|
||||
seconds and the long test 30 seconds. When the maximum speed has not
|
||||
changed for a third of the test duration (5 or 10 seconds) the test
|
||||
changed for a third of the test duration (4 or 10 seconds) the test
|
||||
will end and the result will be final. The long test will use much
|
||||
more bandwidth, so if you're on a cap it's recommended to use the
|
||||
normal test.
|
||||
|
@@ -3,7 +3,7 @@ import { onMount } from "svelte";
|
||||
import Button from "../layout/Button.svelte";
|
||||
import { formatDataVolume, formatDataVolumeBits } from "../util/Formatting.svelte";
|
||||
import ProgressBar from "../util/ProgressBar.svelte";
|
||||
import { copy_text } from "../util/Util.svelte";
|
||||
import CopyButton from "../layout/CopyButton.svelte";
|
||||
|
||||
let running = false
|
||||
let data_received = 0
|
||||
@@ -161,15 +161,9 @@ onMount(() => {
|
||||
|
||||
<section class="highlight_border">
|
||||
<div style="text-align: center">
|
||||
<Button icon="speed" label="Start test" click={() => start(15000)} disabled={running} highlight={!running}/>
|
||||
<Button icon="speed" label="Start test" click={() => start(12000)} disabled={running} highlight={!running}/>
|
||||
<Button icon="speed" label="Long test" click={() => start(30000)} disabled={running}/>
|
||||
<Button
|
||||
highlight_on_click
|
||||
disabled={result_link === ""}
|
||||
icon="content_copy"
|
||||
label="Copy test result"
|
||||
click={e => copy_text(result_link)}
|
||||
/>
|
||||
<CopyButton text={result_link}>Copy test result</CopyButton>
|
||||
</div>
|
||||
|
||||
<!-- This progress bar shows either the progress for the test duration, or
|
||||
|
Reference in New Issue
Block a user