Skip to content

Commit

Permalink
feat(site): improve terminal colors
Browse files Browse the repository at this point in the history
  • Loading branch information
cor committed Sep 28, 2023
1 parent a377a28 commit 3005f6a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions site/src/lib/Xterm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { onMount } from 'svelte';
import { ApolloClient, InMemoryCache, gql } from '@apollo/client/core';
import type { Terminal } from 'xterm';
import type { ApolloQueryResult } from '@apollo/client';
const client = new ApolloClient({
uri: 'https://graphql.union.build/v1/graphql',
Expand All @@ -20,7 +21,7 @@
let terminal: null | Terminal;
let terminalElement: HTMLElement;
let logLines: String[] = [];
let logLines: {network: String, action: String, logLine: String}[] = [];
const scrollToBottom = node => {
Expand All @@ -34,7 +35,7 @@
};
const filter = (r: ApolloQueryResult<any>): null | string => {
const filter = (r: ApolloQueryResult<any>): null | { origin: String, logLine: String } => {
let data = r.data.demo_txes_by_pk;
if (data === null) {
return null
Expand All @@ -45,12 +46,12 @@
let action;
if ('EthereumMinimal' in data) {
network = "[union]: "
network = "union"
data = data['EthereumMinimal']
}
if ('CometblsMinimal' in data) {
network = "[sepolia]: "
network = "sepolia"
data = data['CometblsMinimal']
}
Expand All @@ -73,7 +74,7 @@
return null
}
return network + action + JSON.stringify(data)
return { network, action, logLine: JSON.stringify(data)}
}
Expand Down Expand Up @@ -105,10 +106,10 @@
</script>


<div class="relative h-80">
<div bind:this={terminalElement} class="overflow-auto absolute left-0 right-0 bg-black h-80 text-sm font-jetbrains">
{#each logLines as logline}
<div>{logline}</div>
<div class="relative h-80 my-4">
<div bind:this={terminalElement} class="overflow-auto absolute left-0 right-0 bg-black h-80 text-sm font-jetbrains p-2">
{#each logLines as {network, action, logLine}}
<div><span class={ network == "union" ? "text-accent" : "text-yellow-300"}>[{network}] </span><span>{action}</span><span class="text-gray-400">{logLine}</span></div>
{/each}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion site/src/routes/blog/the-journey-so-far/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Note that this is not a dummy or hacky setup, we have:

<Xterm/>

For the first person that can point us to the contract addresses in use; DM our [twitter](https://x.com/union_build) for a reward.
For the first person that can point us to the contract addresses in use; [DM our X](https://x.com/union_build) for a reward.

## Join the Union

Expand Down

0 comments on commit 3005f6a

Please sign in to comment.