Skip to content

Commit 478e536

Browse files
authored
Merge pull request #14 from magic-pinecone/feature/frontend
Enhance mobile UI with navbar and weekend display options
2 parents 13dca4f + c6ae08e commit 478e536

43 files changed

Lines changed: 6773 additions & 12 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/flutter-ci.yml‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Flutter CI
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- ready_for_review
10+
branches:
11+
- main
12+
paths:
13+
- app/**
14+
- .github/workflows/flutter-ci.yml
15+
push:
16+
branches:
17+
- master
18+
paths:
19+
- app/**
20+
- .github/workflows/flutter-ci.yml
21+
22+
permissions:
23+
contents: read
24+
actions: write
25+
26+
concurrency:
27+
group: flutter-ci-${{ github.ref }}
28+
cancel-in-progress: true
29+
30+
jobs:
31+
analyze-and-test:
32+
runs-on: ubuntu-latest
33+
defaults:
34+
run:
35+
working-directory: app
36+
37+
steps:
38+
- uses: actions/checkout@v6
39+
40+
- uses: subosito/flutter-action@v2
41+
with:
42+
channel: stable
43+
cache: true
44+
45+
- name: Install dependencies
46+
run: flutter pub get
47+
48+
- name: Analyze
49+
run: flutter analyze --fatal-infos
50+
51+
- name: Test
52+
run: flutter test

‎.github/workflows/pages.yml‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy Flutter Web App
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags: ["v*.*.*"]
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
working-directory: app
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6
26+
27+
- name: Set up Flutter
28+
uses: subosito/flutter-action@v2
29+
with:
30+
channel: stable
31+
cache: true
32+
33+
- name: Install dependencies
34+
run: flutter pub get
35+
36+
- name: Analyze
37+
run: flutter analyze
38+
39+
- name: Test
40+
run: flutter test
41+
42+
- name: Build web
43+
run: flutter build web --release --base-href /mpc-lite/
44+
45+
- name: Configure Pages
46+
uses: actions/configure-pages@v6
47+
48+
- name: Upload Pages artifact
49+
uses: actions/upload-pages-artifact@v4
50+
with:
51+
path: app/build/web
52+
53+
deploy:
54+
needs: build
55+
runs-on: ubuntu-latest
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
steps:
60+
- name: Deploy to GitHub Pages
61+
id: deployment
62+
uses: actions/deploy-pages@v5

‎.github/workflows/sync.yml‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout Code
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@v6
2121

2222
- name: Install uv
23-
uses: astral-sh/setup-uv@v5
23+
uses: astral-sh/setup-uv@v8
2424
with:
2525
version: "latest"
2626
enable-cache: true
2727

2828
- name: Set up Python
29-
uses: actions/setup-python@v5
29+
uses: actions/setup-python@v6
3030
with:
3131
python-version-file: ".python-version"
3232

@@ -36,8 +36,6 @@ jobs:
3636
- name: Run Scraper Script
3737
run: uv run python scripts/fetch_data.py
3838

39-
40-
4139
- name: Deploy Scholarship to separate branch
4240
run: |
4341
mkdir -p dist-scholarship

‎README.md‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
# Magic Pinecone Backend Light 🌲
1+
# Magic Pinecone Lite 🌲
22

3-
Welcome to the **Magic Pinecone Backend Light** repository!
3+
Welcome to the **Magic Pinecone Lite** repository!
44

5-
This repository is built as a **serverless static data pipeline**. It runs automatically using GitHub Actions to scrape and format campus data from National Central University (NCU), publishing the resulting clean JSON payloads directly to dedicated Git branches.
5+
This repository is built around two lightweight pieces:
6+
7+
- `app/`: a Flutter web app that exposes only the course selection experience from Magic Pinecone.
8+
- `scripts/`: a serverless static data pipeline that scrapes and formats campus data from National Central University (NCU), publishing clean JSON payloads directly to dedicated Git branches.
69

710
## 🚀 How it Works
811

9-
1. **Automatic Scraping**: GitHub Actions automatically triggers the scraper script (`scripts/fetch_data.py`) **every 10 minutes** (optimized for capturing rapid changes during the peak course selection periods).
10-
2. **Robust Exception Handling**: The scraper is configured to propagate errors. If a core category fetch (scholarship or course list) fails, the execution terminates with a non-zero exit status code, causing the GitHub Action to fail and preventing the publishing of incomplete data. Minor errors (such as individual course detail fetch failures) are gracefully tolerated.
11-
3. **Dynamic Branch Hosting**:
12+
1. **Flutter Web App**: GitHub Actions builds `app/` and deploys it to GitHub Pages with the `/magic-pinecone-lite/` base path.
13+
2. **Automatic Scraping**: GitHub Actions automatically triggers the scraper script (`scripts/fetch_data.py`) **every 10 minutes** (optimized for capturing rapid changes during the peak course selection periods).
14+
3. **Robust Exception Handling**: The scraper is configured to propagate errors. If a core category fetch (scholarship or course list) fails, the execution terminates with a non-zero exit status code, causing the GitHub Action to fail and preventing the publishing of incomplete data. Minor errors (such as individual course detail fetch failures) are gracefully tolerated.
15+
4. **Dynamic Branch Hosting**:
1216
- **Scholarships**: Force-pushed directly to a dedicated branch named `data-scholarship`.
1317
- **Courses**: The scraper automatically parses the current active semester (e.g. `115-1`) and force-pushes the corresponding course data directly to a branch named after the semester (e.g. `115-1`).
14-
4. **Static CDN Access**: The resulting JSON files are hosted directly and completely for free via GitHub's CDN.
18+
5. **Static CDN Access**: The resulting JSON files are hosted directly and completely for free via GitHub's CDN.
1519

1620
---
1721

‎app/.gitignore‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.build/
9+
.buildlog/
10+
.history
11+
.svn/
12+
.swiftpm/
13+
migrate_working_dir/
14+
15+
# IntelliJ related
16+
*.iml
17+
*.ipr
18+
*.iws
19+
.idea/
20+
21+
# The .vscode folder contains launch configuration and tasks you configure in
22+
# VS Code which you may wish to be included in version control, so this line
23+
# is commented out by default.
24+
#.vscode/
25+
26+
# Flutter/Dart/Pub related
27+
**/doc/api/
28+
**/ios/Flutter/.last_build_id
29+
.dart_tool/
30+
.flutter-plugins-dependencies
31+
.pub-cache/
32+
.pub/
33+
/build/
34+
/coverage/
35+
36+
# Symbolication related
37+
app.*.symbols
38+
39+
# Obfuscation related
40+
app.*.map.json
41+
42+
# Android Studio will place build artifacts here
43+
/android/app/debug
44+
/android/app/profile
45+
/android/app/release

‎app/.metadata‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: "559ffa3f75e7402d65a8def9c28389a9b2e6fe42"
8+
channel: "stable"
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 559ffa3f75e7402d65a8def9c28389a9b2e6fe42
17+
base_revision: 559ffa3f75e7402d65a8def9c28389a9b2e6fe42
18+
- platform: web
19+
create_revision: 559ffa3f75e7402d65a8def9c28389a9b2e6fe42
20+
base_revision: 559ffa3f75e7402d65a8def9c28389a9b2e6fe42
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

‎app/README.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Magic Pinecone Lite App
2+
3+
Flutter web app for the course selection slice of Magic Pinecone Lite.
4+
5+
The app consumes static course JSON from the `magic-pinecone-lite` data branches:
6+
7+
- `courses.json` from the active semester branch
8+
- `detail/<serial_no>.json` for course detail panes
9+
10+
## Local Development
11+
12+
```bash
13+
flutter pub get
14+
flutter run -d chrome
15+
```
16+
17+
## GitHub Pages Build
18+
19+
Use a base href that matches the repository path:
20+
21+
```bash
22+
flutter build web --release --base-href /magic-pinecone-lite/
23+
```

‎app/analysis_options.yaml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/lints.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26+
27+
# Additional information about this file can be found at
28+
# https://dart.dev/guides/language/analysis-options

‎app/lib/core/app/app_theme.dart‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import 'package:flutter/material.dart';
2+
3+
class AppThemeController extends ValueNotifier<ThemeMode> {
4+
AppThemeController() : super(ThemeMode.system);
5+
6+
void toggle() {
7+
value = value == ThemeMode.dark ? ThemeMode.light : ThemeMode.dark;
8+
}
9+
10+
void setDarkMode(bool enabled) {
11+
value = enabled ? ThemeMode.dark : ThemeMode.light;
12+
}
13+
14+
bool get isDark => value == ThemeMode.dark;
15+
}
16+
17+
class AppTheme {
18+
AppTheme._();
19+
20+
static final light = ThemeData(
21+
brightness: Brightness.light,
22+
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
23+
scaffoldBackgroundColor: Colors.grey.shade50,
24+
appBarTheme: const AppBarTheme(elevation: 0, scrolledUnderElevation: 0.5),
25+
cardTheme: CardThemeData(
26+
color: Colors.white,
27+
elevation: 4.0,
28+
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
29+
),
30+
navigationBarTheme: const NavigationBarThemeData(elevation: 1),
31+
);
32+
33+
static final dark = ThemeData(
34+
brightness: Brightness.dark,
35+
colorScheme: ColorScheme.fromSeed(
36+
seedColor: Colors.blue,
37+
brightness: Brightness.dark,
38+
),
39+
scaffoldBackgroundColor: const Color(0xFF121212),
40+
appBarTheme: const AppBarTheme(elevation: 0, scrolledUnderElevation: 0.5),
41+
cardTheme: CardThemeData(
42+
color: const Color(0xFF1E1E1E),
43+
elevation: 4.0,
44+
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
45+
),
46+
navigationBarTheme: const NavigationBarThemeData(elevation: 1),
47+
);
48+
}

0 commit comments

Comments
 (0)