further improvement of UI

This commit is contained in:
Samuel Andert 2023-09-06 15:49:50 +02:00
parent aaf4a7461a
commit 563e9945c3
3 changed files with 49 additions and 47 deletions

View File

@ -6,8 +6,9 @@
} from "./services/mutateAccessControlConditions.ts"; } from "./services/mutateAccessControlConditions.ts";
let signingConditions = let signingConditions =
JSON.parse(localStorage.getItem("signingConditions")) || []; JSON.parse(localStorage.getItem("signingConditions")) || [];
let newParameter = "";
let newComparator = ""; let newParameter = ":userAddress";
let newComparator = "=";
let newValue = ""; let newValue = "";
async function handleCreateNewACC() { async function handleCreateNewACC() {
@ -24,48 +25,50 @@
} }
</script> </script>
<h1>Access Control Conditions</h1>
{#each signingConditions as condition, index (index)} {#each signingConditions as condition, index (index)}
{#each condition.accs as acc} {#each condition.accs as acc}
<div class="text-lg p-4 border rounded-md shadow-md"> <div
<span class="text-xl" class="card"
><b>{condition.resourceId.baseUrl}{condition.resourceId.path}</b></span style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;"
> >
<div class="p-4">
<h2 class="text-xl">
<b>{condition.resourceId.baseUrl}{condition.resourceId.path}</b>
</h2>
<p> <p>
{acc.parameters.join(", ")} {acc.parameters.join(", ")}
{acc.returnValueTest.comparator} {acc.returnValueTest.comparator}
{acc.returnValueTest.value} {acc.returnValueTest.value}
</p> </p>
<p>
<span class="text-xs">{JSON.stringify(condition)}</span>
</p>
</div> </div>
{/each}
<p />
<p />
<button <button
on:click={() => handleDeleteACC(index)} on:click={() => handleDeleteACC(index)}
class="mt-2 px-4 py-2 bg-red-500 text-white rounded-md">Delete ACC</button class="btn variant-filled-error mt-2">Delete ACC</button
> >
</div>
{/each}
{/each} {/each}
<div class="mt-4"> <div class="mt-4 flex">
<input <input
bind:value={newParameter} bind:value={newParameter}
placeholder="Parameter" placeholder="Parameter"
class="px-4 py-2 border rounded-md mr-2" class="input mr-2"
style="width: max-content; max-width: 125px;"
readonly
/> />
<input <input
bind:value={newComparator} bind:value={newComparator}
placeholder="Comparator" placeholder="Comparator"
class="px-4 py-2 border rounded-md mr-2" class="input mr-2"
style="width: max-content; max-width: 36px;"
readonly
/> />
<input <input
bind:value={newValue} bind:value={newValue}
placeholder="Value" placeholder="Value"
class="px-4 py-2 border rounded-md mr-2" class="input mr-2 flex-grow"
/> />
<button <button on:click={handleCreateNewACC} class="btn variant-filled flex-grow"
on:click={handleCreateNewACC} >Create New ACC</button
class="px-4 py-2 bg-blue-500 text-white rounded-md">Create New ACC</button
> >
</div> </div>

View File

@ -9,6 +9,7 @@
startSignIn as startSignInService, startSignIn as startSignInService,
} from "./services/signInWithGoogle"; } from "./services/signInWithGoogle";
import { getDrawerStore } from "@skeletonlabs/skeleton"; import { getDrawerStore } from "@skeletonlabs/skeleton";
import { goto } from "$app/navigation";
const { state, send } = useMachine(walletMachine); const { state, send } = useMachine(walletMachine);
const drawerStore = getDrawerStore(); const drawerStore = getDrawerStore();
@ -66,7 +67,7 @@
<div class="flex flex-col items-center w-1/3"> <div class="flex flex-col items-center w-1/3">
<button <button
on:click={startSignIn} on:click={startSignIn}
class="flex items-center justify-center w-full py-2 text-white bg-blue-500 rounded hover:bg-blue-700" class="btn variant-filled flex items-center justify-center py-2"
> >
<span class="mr-2"><Icon icon="flat-color-icons:google" /></span> <span class="mr-2"><Icon icon="flat-color-icons:google" /></span>
<span>Sign in with Google</span> <span>Sign in with Google</span>
@ -78,22 +79,20 @@
<div class="flex items-center justify-between w-full space-x-4"> <div class="flex items-center justify-between w-full space-x-4">
<div class="w-full h-full overflow-hidden grid grid-cols-6"> <div class="w-full h-full overflow-hidden grid grid-cols-6">
<aside class="col-span-1"> <aside class="col-span-1">
<a href="/me" on:click|preventDefault={() => goto("/me")}>
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<Icon <Icon
icon="iconamoon:profile-circle-fill" icon="iconamoon:profile-circle-fill"
class="w-12 h-12 text-gray-500" class="w-12 h-12 text-gray-500"
/> />
<div> <div>
<p class="text-sm"> <div class="text-sm">
<span class="font-semibold">Address:</span> <div class="font-semibold">Address</div>
{$state.context.pkps[0].ethAddress.substring(0, 8) + "..."} {$state.context.pkps[0].ethAddress.substring(0, 8) + "..."}
</p>
<p class="text-xs">
<span class="font-semibold">Provider:</span>
{$state.context.providerName}
</p>
</div> </div>
</div> </div>
</div>
</a>
</aside> </aside>
<div class="col-span-5 w-full"> <div class="col-span-5 w-full">
<div class="flex justify-end space-x-4"> <div class="flex justify-end space-x-4">
@ -132,9 +131,9 @@
</div> </div>
{/if} {/if}
{:else} {:else}
<div class="p-10 bg-white rounded-full"> <div class="flex justify-center items-center w-full pb-4">
<div class="p-5 bg-white rounded-full animate-spin"> <div class="animate-spin">
<Icon icon="la:spinner" width="100" height="100" /> <Icon icon="la:spinner" width="48" height="48" />
</div> </div>
</div> </div>
{/if} {/if}

View File

@ -52,7 +52,7 @@ const walletMachine = createMachine({
actions: [ actions: [
assign({ assign({
pkps: (_, event) => event.data, pkps: (_, event) => event.data,
}) }),
], ],
}, },
onError: 'authenticated', onError: 'authenticated',