Skip to content

Commit 3b44d02

Browse files
jayantkcctdaniel
andauthored
[oracle-swap] Improve oracle-swap frontend (#544)
* stuff * make this look better * improving ux * basic functionality works * clean up appearance * 3 seconds * clean up code a bit * blah * change website title and favicon and fix useEffect warning * actually change website title and fix useEffect warning * update metadata * trigger deployment --------- Co-authored-by: Daniel Chew <[email protected]>
1 parent 4c5d0d5 commit 3b44d02

File tree

16 files changed

+1374
-563
lines changed

16 files changed

+1374
-563
lines changed
Binary file not shown.
Binary file not shown.

target_chains/ethereum/examples/oracle_swap/app/public/index.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<meta name="theme-color" content="#000000" />
88
<meta
99
name="description"
10-
content="Web site created using create-react-app"
10+
content="Example oracle AMM application using Pyth price feeds."
1111
/>
1212
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
1313
<!--
@@ -24,7 +24,17 @@
2424
work correctly both with client-side routing and a non-root public URL.
2525
Learn how to configure a non-root public URL by running `npm run build`.
2626
-->
27-
<title>React App</title>
27+
<title>Pyth Example Oracle AMM</title>
28+
<script>
29+
const faviconTag = document.querySelector("link[rel~='icon']");
30+
const isDark = window.matchMedia("(prefers-color-scheme: dark)");
31+
const changeFavicon = () => {
32+
if (isDark.matches) faviconTag.href = "/favicon-light.ico";
33+
else faviconTag.href = "/favicon.ico";
34+
};
35+
changeFavicon();
36+
setInterval(changeFavicon, 1000);
37+
</script>
2838
</head>
2939
<body>
3040
<noscript>You need to enable JavaScript to run this app.</noscript>
Lines changed: 99 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,112 @@
11
.App {
2-
text-align: center;
3-
}
4-
5-
.App-logo {
6-
height: 40vmin;
7-
pointer-events: none;
8-
}
9-
10-
@media (prefers-reduced-motion: no-preference) {
11-
.App-logo {
12-
animation: App-logo-spin infinite 20s linear;
13-
}
2+
text-align: left;
3+
display: flex;
144
}
155

16-
.App-header {
6+
.control-panel {
7+
flex: 1;
178
background-color: #282c34;
189
min-height: 100vh;
10+
max-width: fit-content;
1911
display: flex;
2012
flex-direction: column;
21-
align-items: center;
22-
justify-content: center;
23-
font-size: calc(10px + 2vmin);
13+
justify-content: flex-start;
2414
color: white;
15+
padding: 5px;
16+
}
17+
18+
.main {
19+
flex: 1;
20+
padding: 0 20px;
21+
}
22+
23+
.tab-header {
24+
display: flex;
25+
}
26+
27+
.tab-item {
28+
flex: 1;
29+
text-align: center;
30+
padding: 10px;
31+
cursor: pointer;
32+
background-color: #ddd;
33+
border: 1px solid black;
34+
}
35+
36+
.tab-item.active {
37+
background-color: #fff;
38+
border-bottom: 0px;
39+
}
40+
41+
.tab-content {
42+
padding: 10px;
43+
border: 1px solid black;
44+
border-top: 0px;
45+
}
46+
47+
.icon-container {
48+
display: inline-block;
49+
position: relative;
50+
text-decoration: underline;
51+
}
52+
53+
.tooltip {
54+
position: absolute;
55+
top: 5px; /* adjust as needed */
56+
left: 30px; /* adjust as needed */
57+
background-color: #333;
58+
color: #fff;
59+
padding: 5px 10px;
60+
border-radius: 3px;
61+
font-size: 12px;
62+
visibility: hidden;
63+
opacity: 0;
64+
transition: all 0.3s ease-in-out;
65+
width: 200px;
66+
}
67+
68+
.icon-container:hover .tooltip {
69+
visibility: visible;
70+
opacity: 1;
71+
}
72+
73+
.exchange-rate {
74+
color: green;
75+
}
76+
77+
.last-updated {
78+
color: #777;
79+
}
80+
81+
h1,
82+
h2,
83+
h3,
84+
h4,
85+
h5,
86+
p,
87+
input {
88+
padding: 0;
89+
margin: 0;
90+
}
91+
92+
h3 {
93+
margin: 30px 0px 3px;
94+
}
95+
96+
p {
97+
margin: 5px 0px 6px 0px;
98+
}
99+
100+
input[type="text"] {
101+
padding: 3px;
102+
margin: 10px 5px;
103+
text-align: right;
25104
}
26105

27-
.App-link {
28-
color: #61dafb;
106+
.swap-steps {
107+
margin: 10px 0px;
29108
}
30109

31-
@keyframes App-logo-spin {
32-
from {
33-
transform: rotate(0deg);
34-
}
35-
to {
36-
transform: rotate(360deg);
37-
}
110+
button {
111+
margin: 0px 5px 0px 5px;
38112
}

0 commit comments

Comments
 (0)