<script lang="ts">
	import { browser } from '$app/environment';
	import { goto } from '$app/navigation';
	import root from '$lib/Utility/root';
	import { tools } from './tools';

	export let tool: string;
</script>

<blockquote>
	<select
		bind:value={tool}
		on:change={() => {
			if (browser) goto(root(`/tools/${tool}`));
		}}
	>
		<option value="default" selected disabled hidden>Select a tool to continue</option>

		{#each Object.keys(tools).filter((t) => t !== 'default') as t}
			<option value={t}>{tools[t].short || tools[t].name()}</option>
		{/each}
	</select>
</blockquote>
