Skip to content

Commit fe4a2e9

Browse files
committed
Added cloudflare workers
1 parent 5c369c0 commit fe4a2e9

12 files changed

Lines changed: 469 additions & 20 deletions

File tree

‎.DS_Store‎

6 KB
Binary file not shown.

‎package-lock.json‎

Lines changed: 26 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@
1212
"@cloudflare/vitest-pool-workers": "^0.8.19",
1313
"vitest": "~3.2.0",
1414
"wrangler": "^4.34.0"
15+
},
16+
"dependencies": {
17+
"openai": "^5.20.0"
1518
}
1619
}

‎src/images/add.svg‎

Lines changed: 13 additions & 0 deletions
Loading

‎src/images/loader.svg‎

Lines changed: 5 additions & 0 deletions
Loading

‎src/images/logo-dave-text.png‎

55 KB
Loading

‎src/index.css‎

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
html, body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: 'Poppins', sans-serif;
5+
background-color: #f6f6f6;
6+
}
7+
8+
* {
9+
box-sizing: border-box;
10+
}
11+
12+
header {
13+
display: flex;
14+
justify-content: center;
15+
padding: 1em;
16+
background-color: black;
17+
margin: 0 auto;
18+
}
19+
20+
header img {
21+
width: 340px;
22+
}
23+
24+
main {
25+
display: flex;
26+
justify-content: center;
27+
}
28+
29+
/* Panels */
30+
31+
.action-panel, .output-panel {
32+
line-height: 1.4em;
33+
display: flex;
34+
height: 350px;
35+
flex-direction: column;
36+
justify-content: space-around;
37+
align-items: center;
38+
margin: 1.5em 2em;
39+
}
40+
41+
.output-panel {
42+
display: none;
43+
justify-content: flex-start;
44+
border: 2px solid;
45+
padding: 1em 2em;
46+
}
47+
48+
.loading-panel {
49+
display: none;
50+
flex-direction: column;
51+
justify-content: space-around;
52+
height: 400px;
53+
text-align: center;
54+
}
55+
56+
.output-panel p{
57+
overflow-y: scroll;
58+
}
59+
60+
/* text */
61+
62+
h2 {
63+
text-align: center;
64+
font-weight: 400;
65+
margin-top: -26px;
66+
background-color: #f6f6f6;
67+
padding: 0 10px;
68+
font-size: 18px;
69+
margin-bottom: 0;
70+
}
71+
72+
p.tag-line {
73+
font-family: 'Comic Neue';
74+
font-weight: 700;
75+
font-size: 14px;
76+
}
77+
78+
.ticker-choice-display {
79+
display: flex;
80+
align-items: center;
81+
height: 3em;
82+
}
83+
84+
/* controls */
85+
86+
form {
87+
width: 360px;
88+
display: flex;
89+
flex-direction: column;
90+
align-items: center;
91+
}
92+
93+
label {
94+
text-align: center;
95+
padding: .43em;
96+
font-size: 15px;
97+
margin-bottom: 1em;
98+
width: 80%;
99+
}
100+
101+
.form-input-control {
102+
display: flex;
103+
width: 70%;
104+
}
105+
106+
input[type="text"] {
107+
padding: 1em;
108+
border: 2px solid black;
109+
border-right: none;
110+
}
111+
112+
/* Buttons */
113+
114+
.add-ticker-btn {
115+
display: flex;
116+
align-items: center;
117+
background-color: #ffffff;
118+
font-size: 3em;
119+
padding: 0 .35em;
120+
cursor: pointer;
121+
border: 2px solid;
122+
}
123+
124+
.add-ticker-btn:hover {
125+
background-color: #d2d2d2;
126+
}
127+
128+
.add-ticker-svg {
129+
width: 14px;
130+
}
131+
132+
.generate-report-btn {
133+
width: 70%;
134+
padding: 1em 1.5em;
135+
cursor: pointer;
136+
font-family: 'Poppins', sans;
137+
border: 2px solid #000000;
138+
background-color: #46ff90;
139+
text-transform: uppercase;
140+
font-weight: 500;
141+
letter-spacing: .09em;
142+
font-size: 105%;
143+
}
144+
145+
/* ticker display (ensure comma separated) */
146+
147+
.ticker {
148+
margin: 0 .1em;
149+
content: '';
150+
}
151+
152+
.ticker:after {
153+
content: ',';
154+
}
155+
156+
.ticker:last-child::after {
157+
content: '';
158+
}
159+
160+
/* footer */
161+
162+
footer {
163+
font-size: 14px;
164+
text-align: center;
165+
}
166+
167+
/* stop ugly scroll bar on some browsers */
168+
.output-panel p::-webkit-scrollbar {
169+
display: none;
170+
}
171+
172+
.output-panel p::-moz-scrollbar {
173+
display: none;
174+
}

‎src/index.html‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Dodgy Dave's Stock Predictions</title>
5+
<link rel="stylesheet" href="index.css">
6+
<link rel="preconnect" href="https://fonts.googleapis.com">
7+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
8+
<link href="https://fonts.googleapis.com/css2?family=Comic+Neue:wght@700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
9+
<meta name="viewport" content="width=device-width, initial-scale=1">
10+
<meta charset="UTF-8">
11+
</head>
12+
13+
<body>
14+
<header>
15+
<img src="images/logo-dave-text.png" alt="Dodgy Dave's Stock Predictions">
16+
</header>
17+
<main>
18+
<section class="action-panel">
19+
<form id="ticker-input-form">
20+
<label for="ticker-input"> Add up to 3 stock tickers below to get a super accurate stock predictions report👇 </label>
21+
<div class="form-input-control">
22+
<input type="text" id="ticker-input" placeholder="MSFT">
23+
<button class="add-ticker-btn">
24+
<img src="images/add.svg" class="add-ticker-svg" alt="add">
25+
</button>
26+
</div>
27+
</form>
28+
<p class="ticker-choice-display">
29+
Your tickers will appear here...
30+
</p>
31+
<button class="generate-report-btn" type="button" disabled>
32+
Generate Report
33+
</button>
34+
<p class="tag-line">Always correct 15% of the time!</p>
35+
</section>
36+
<section class="loading-panel">
37+
<img src="images/loader.svg" alt="loading">
38+
<div id="api-message">Querying Stocks API...</div>
39+
</section>
40+
<section class="output-panel">
41+
<h2>Your Report 😜</h2>
42+
</section>
43+
</main>
44+
<footer>
45+
&copy; This is not real financial advice!
46+
</footer>
47+
<script src="index.js" type="module"></script>
48+
</body>
49+
</html>

0 commit comments

Comments
 (0)