mirror of
https://github.com/davegallant/rfd-fyi.git
synced 2026-03-03 17:46:35 +00:00
Compare commits
190 Commits
renovate/m
...
c13bd92c2b
| Author | SHA1 | Date | |
|---|---|---|---|
| c13bd92c2b | |||
| ea871e3fb4 | |||
| d523c31953 | |||
| 928ee46b9d | |||
| ca58af6a57 | |||
| 640feea592 | |||
| 45dfa503aa | |||
| 87f98fa8c0 | |||
| e8dc79f981 | |||
| 985519f850 | |||
| 8c58cd466d | |||
| 61492157c3 | |||
| 2176a49ce2 | |||
| fe616c06c3 | |||
| a091f0ef0e | |||
| 1e69b2b57e | |||
|
|
3c93910723 | ||
|
|
e2882c2e3a | ||
|
|
73ea77e935 | ||
|
|
6bf5cd8e19 | ||
|
|
ba0d5c592a | ||
| 7a3ff92e06 | |||
|
|
6c0109684c | ||
|
|
8436524f67 | ||
|
|
f268097e89 | ||
|
|
f68acccc06 | ||
|
|
210898bbc4 | ||
|
|
dfab73666a | ||
|
|
8184d1746f | ||
|
|
f78d9d4eda | ||
|
|
777b0b02dc | ||
|
|
f270e0ebfa | ||
|
|
15d8223278 | ||
|
|
94d5e44768 | ||
|
|
c0cfeb7897 | ||
|
|
ecfe0b35c2 | ||
|
|
0d9e05b296 | ||
|
|
d4bd76f89b | ||
| 76ca6fe575 | |||
| 4039e2f7e8 | |||
|
|
70d542c412 | ||
|
|
d882408ba8 | ||
|
|
28dd98b6f1 | ||
|
|
84df9955af | ||
|
|
ef6227ea4c | ||
|
|
42fc4acc53 | ||
|
|
e3653502d4 | ||
|
|
425937be0b | ||
|
|
df8aadcace | ||
|
|
f9be7b3bd5 | ||
|
|
481be9282e | ||
|
|
5ae841b999 | ||
|
|
79b0d2e9ed | ||
|
|
af0662ac84 | ||
|
|
833232a5ab | ||
|
|
d3123c9abf | ||
|
|
3adce1c83f | ||
|
|
6936785c13 | ||
|
|
73cef0c5c3 | ||
|
|
803b642864 | ||
|
|
d9dca2a418 | ||
|
|
81dd8141f3 | ||
|
|
424198f140 | ||
|
|
e22d427b1f | ||
|
|
2e88601478 | ||
|
|
b95c4aae0a | ||
|
|
651d655ddd | ||
|
|
07fcb9abb6 | ||
|
|
f4f44d2de7 | ||
|
|
8d45ff85cc | ||
|
|
7bb29b43ca | ||
|
|
b00974e328 | ||
|
|
ab2046c714 | ||
|
|
167e8da14d | ||
|
|
bc5389e01b | ||
|
|
1f63e7327b | ||
|
|
2c6a65ffe7 | ||
|
|
ce83c19e5d | ||
|
|
87a82445c2 | ||
|
|
5d2e51cc81 | ||
|
|
a40103768c | ||
|
|
b1174f2975 | ||
|
|
61eb9e117b | ||
|
|
a2c6eeb3c2 | ||
|
|
a805fa16a9 | ||
|
|
def4338a2d | ||
|
|
9355275ece | ||
|
|
bc73749b75 | ||
|
|
2156330f96 | ||
|
|
c7dc0dba2f | ||
|
|
f22c8a561b | ||
| b29377a962 | |||
|
|
80f650736f | ||
|
|
48c4162746 | ||
| 926617056f | |||
| 485e04afe2 | |||
| 8bae1c4978 | |||
| ce4396dd0d | |||
| f0e33e6060 | |||
| 065c965f00 | |||
|
|
b2bea9a424 | ||
|
|
1969569143 | ||
|
|
286da4cf54 | ||
|
|
eebf0478c5 | ||
|
|
34478e9ede | ||
|
|
a8dd3a4839 | ||
|
|
10a6ae4964 | ||
|
|
fcbdf15180 | ||
|
|
968a417f60 | ||
|
|
05fb199525 | ||
|
|
9e4a84dbbb | ||
|
|
665edf0c80 | ||
|
|
ef7448f02f | ||
|
|
60dfad2c66 | ||
|
|
f60dd55178 | ||
|
|
e7a47adca5 | ||
|
|
d54b07172e | ||
| f60e4cf1cf | |||
|
|
d4253ed8e2 | ||
|
|
a0ee6bb6c8 | ||
|
|
5f7e848670 | ||
|
|
f2c05bce92 | ||
|
|
0e34c00b99 | ||
|
|
c20f4fb32a | ||
|
|
052e2d92d9 | ||
|
|
b367ad0a46 | ||
|
|
16ef189fe4 | ||
|
|
89d3d70ef9 | ||
|
|
00e3c8ad5e | ||
|
|
6444cac6ee | ||
| b15a4fa107 | |||
|
|
5d31dc83cb | ||
|
|
4414aa4310 | ||
|
|
03af1b65ca | ||
|
|
7d01083ba8 | ||
|
|
373a4d0186 | ||
|
|
98d5be8d5c | ||
|
|
e9a60c95f7 | ||
|
|
d713534616 | ||
|
|
2a6fcbd184 | ||
|
|
727a9336a4 | ||
|
|
dc13d241bf | ||
|
|
a45aec3abc | ||
|
|
4ff537c08f | ||
|
|
e20e7121d8 | ||
|
|
09ba6e6e2a | ||
|
|
d2258f6c36 | ||
|
|
5dd59be6aa | ||
|
|
77ad9f82a1 | ||
|
|
c332d7b0f2 | ||
|
|
7dc8d88c5a | ||
|
|
923c696654 | ||
|
|
008fa15fb4 | ||
|
|
1d81ec5db1 | ||
|
|
e6649ed164 | ||
|
|
2416692599 | ||
|
|
fd45c0f59b | ||
|
|
101c076fc7 | ||
|
|
d54726caf3 | ||
|
|
5c2af86a7d | ||
|
|
3fc875747f | ||
|
|
705ddef485 | ||
|
|
1b1a16e383 | ||
|
|
844b55dd5d | ||
|
|
08f28d2f21 | ||
|
|
74d017d988 | ||
|
|
8942c09f5a | ||
|
|
614c8efb72 | ||
|
|
21b7af4217 | ||
|
|
6dce79e164 | ||
|
|
720cc04874 | ||
|
|
919edad7db | ||
|
|
a1b2102b05 | ||
|
|
e3cb281c85 | ||
|
|
c5dfe13931 | ||
|
|
287dfd2342 | ||
|
|
5d5d353520 | ||
|
|
4ae3e97d89 | ||
|
|
59ec1761a8 | ||
|
|
1cc50f9797 | ||
|
|
c64b121875 | ||
|
|
c6b7cf43b5 | ||
|
|
69177cd495 | ||
|
|
736354d15a | ||
|
|
b1df149c5e | ||
|
|
7e59cd256a | ||
|
|
1c5059e4cb | ||
|
|
e1e662c1ed | ||
|
|
944a5efff0 | ||
|
|
377afec5a4 |
4
.browserslistrc
Normal file
4
.browserslistrc
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
> 1%
|
||||||
|
last 2 versions
|
||||||
|
not dead
|
||||||
|
not ie 11
|
||||||
2
.github/workflows/dependency-review.yml
vendored
2
.github/workflows/dependency-review.yml
vendored
@@ -15,6 +15,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout Repository'
|
- name: 'Checkout Repository'
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
- name: 'Dependency Review'
|
- name: 'Dependency Review'
|
||||||
uses: actions/dependency-review-action@v4
|
uses: actions/dependency-review-action@v4
|
||||||
|
|||||||
4
.github/workflows/publish-containers.yml
vendored
4
.github/workflows/publish-containers.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
name: Publish rfd-fyi-backend
|
name: Publish rfd-fyi-backend
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
id: prep
|
id: prep
|
||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
name: Publish rfd-fyi-frontend
|
name: Publish rfd-fyi-frontend
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
id: prep
|
id: prep
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,3 +5,5 @@ backend/bin/
|
|||||||
.vscode
|
.vscode
|
||||||
*.pem
|
*.pem
|
||||||
.env
|
.env
|
||||||
|
.direnv
|
||||||
|
.envrc.local
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
rfd.fyi
|
{
|
||||||
|
auto_https off
|
||||||
|
}
|
||||||
|
|
||||||
|
:80 {
|
||||||
file_server
|
file_server
|
||||||
|
reverse_proxy /api/* rfd-fyi-backend:8080
|
||||||
reverse_proxy /api/* backend:8080
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM node:20.2.0-alpine3.16 AS builder
|
FROM node:20.2.0-alpine3.16 as builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ COPY . .
|
|||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM caddy:2.8.4-alpine AS runtime
|
FROM caddy:2.10.2-alpine as runtime
|
||||||
|
|
||||||
WORKDIR /my-site
|
WORKDIR /my-site
|
||||||
|
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -15,13 +15,12 @@ help:
|
|||||||
|
|
||||||
## backend: Build and run the backend from source
|
## backend: Build and run the backend from source
|
||||||
backend:
|
backend:
|
||||||
@cd backend && go run .
|
@cd backend && CGO_ENABLED=0 go run .
|
||||||
.PHONY: backend
|
.PHONY: backend
|
||||||
|
|
||||||
## frontend: Build and run the frontend from source
|
## frontend: Build and run the frontend from source
|
||||||
frontend:
|
frontend:
|
||||||
@npm install @vue/cli-service
|
@npm run serve
|
||||||
@npx vue-cli-service serve
|
|
||||||
.PHONY: frontend
|
.PHONY: frontend
|
||||||
|
|
||||||
## dev: Build and run in docker compose
|
## dev: Build and run in docker compose
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
# rfd.fyi
|
# rfd-fyi
|
||||||
|
|
||||||
This repository provides a simple, less-distracting overlay for hot deals posted on https://forums.redflagdeals.com.
|
This repository provides a simple, less-distracting overlay for hot deals posted on https://forums.redflagdeals.com.
|
||||||
|
|
||||||
The frontend is made with Vue 3 and the backend is written in Go. The backend exists for caching purposes; to prevent excessive requests to RedFlagDeals itself.
|
The frontend is made with Vue 3 and the backend is written in Go. The backend exists for caching purposes; to prevent excessive requests to RedFlagDeals itself.
|
||||||
|
|
||||||
It is hosted at [rfd.fyi](https://rfd.fyi).
|
|
||||||
|
|
||||||
## Local Development
|
## Local Development
|
||||||
|
|
||||||
To get up and running locally: in one pane/tab, run:
|
To get up and running locally: in one pane/tab, run:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# syntax=docker/dockerfile:1.9
|
# syntax=docker/dockerfile:1.21
|
||||||
FROM cgr.dev/chainguard/go:latest as build
|
FROM cgr.dev/chainguard/go:latest AS build
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
|
|||||||
105
backend/app.go
105
backend/app.go
@@ -63,6 +63,7 @@ func (a *App) Run(httpPort string) {
|
|||||||
|
|
||||||
func (a *App) initializeRoutes() {
|
func (a *App) initializeRoutes() {
|
||||||
a.Router.HandleFunc("/topics", a.listTopics).Methods("GET")
|
a.Router.HandleFunc("/topics", a.listTopics).Methods("GET")
|
||||||
|
a.Router.HandleFunc("/topics/{id}", a.getTopicDetails).Methods("GET")
|
||||||
}
|
}
|
||||||
|
|
||||||
// func respondWithError(w http.ResponseWriter, code int, message string) {
|
// func respondWithError(w http.ResponseWriter, code int, message string) {
|
||||||
@@ -87,16 +88,104 @@ func (a *App) listTopics(w http.ResponseWriter, r *http.Request) {
|
|||||||
respondWithJSON(w, http.StatusOK, a.CurrentTopics)
|
respondWithJSON(w, http.StatusOK, a.CurrentTopics)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getTopicDetails godoc
|
||||||
|
// @Summary Get detailed information about a specific topic
|
||||||
|
// @Description Fetches full details including recent comments for a topic by ID
|
||||||
|
// @ID get-topic-details
|
||||||
|
// @Param id path int true "Topic ID"
|
||||||
|
// @Router /topics/{id} [get]
|
||||||
|
// @Success 200 {object} TopicDetails
|
||||||
|
func (a *App) getTopicDetails(w http.ResponseWriter, r *http.Request) {
|
||||||
|
vars := mux.Vars(r)
|
||||||
|
topicID := vars["id"]
|
||||||
|
|
||||||
|
// Find topic in current topics
|
||||||
|
var topic *Topic
|
||||||
|
for i := range a.CurrentTopics {
|
||||||
|
if fmt.Sprintf("%d", a.CurrentTopics[i].TopicID) == topicID {
|
||||||
|
topic = &a.CurrentTopics[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if topic == nil {
|
||||||
|
respondWithJSON(w, http.StatusNotFound, map[string]string{"error": "Topic not found"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch detailed info from RFD API
|
||||||
|
requestURL := fmt.Sprintf("https://forums.redflagdeals.com/api/topics/%s", topicID)
|
||||||
|
res, err := http.Get(requestURL)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn().Msgf("error fetching topic details: %s\n", err)
|
||||||
|
respondWithJSON(w, http.StatusInternalServerError, map[string]string{"error": "Failed to fetch details"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
body, err := ioutil.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn().Msgf("could not read response body: %s\n", err)
|
||||||
|
respondWithJSON(w, http.StatusInternalServerError, map[string]string{"error": "Failed to read response"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var rfdResponse map[string]interface{}
|
||||||
|
err = json.Unmarshal([]byte(body), &rfdResponse)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn().Msgf("could not unmarshal response body: %s", err)
|
||||||
|
respondWithJSON(w, http.StatusInternalServerError, map[string]string{"error": "Failed to parse response"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract relevant fields for tooltip
|
||||||
|
details := TopicDetails{
|
||||||
|
Topic: *topic,
|
||||||
|
Description: extractDescription(rfdResponse),
|
||||||
|
FirstPost: extractFirstPost(rfdResponse),
|
||||||
|
}
|
||||||
|
|
||||||
|
respondWithJSON(w, http.StatusOK, details)
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractDescription(data map[string]interface{}) string {
|
||||||
|
if topic, ok := data["topic"].(map[string]interface{}); ok {
|
||||||
|
if description, ok := topic["description"].(string); ok {
|
||||||
|
return description
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractFirstPost(data map[string]interface{}) string {
|
||||||
|
if posts, ok := data["posts"].([]interface{}); ok && len(posts) > 0 {
|
||||||
|
if firstPost, ok := posts[0].(map[string]interface{}); ok {
|
||||||
|
if body, ok := firstPost["body"].(string); ok {
|
||||||
|
// Truncate to first 200 characters
|
||||||
|
if len(body) > 200 {
|
||||||
|
return body[:200] + "..."
|
||||||
|
}
|
||||||
|
return body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (a *App) refreshTopics() {
|
func (a *App) refreshTopics() {
|
||||||
for {
|
for {
|
||||||
log.Info().Msg("Refreshing topics")
|
log.Info().Msg("Refreshing topics")
|
||||||
latestTopics := a.getDeals(9, 1, 6)
|
latestTopics := a.getDeals(9, 1, 6)
|
||||||
|
|
||||||
|
if len(latestTopics) > 0 {
|
||||||
|
latestTopics = a.deduplicateTopics(latestTopics)
|
||||||
latestTopics = a.updateScores(latestTopics)
|
latestTopics = a.updateScores(latestTopics)
|
||||||
|
|
||||||
log.Info().Msg("Refreshing redirects")
|
log.Info().Msg("Refreshing redirects")
|
||||||
latestRedirects := a.getRedirects()
|
latestRedirects := a.getRedirects()
|
||||||
a.Redirects = latestRedirects
|
a.Redirects = latestRedirects
|
||||||
a.CurrentTopics = a.stripRedirects(latestTopics)
|
a.CurrentTopics = a.stripRedirects(latestTopics)
|
||||||
|
}
|
||||||
|
|
||||||
a.LastRefresh = time.Now()
|
a.LastRefresh = time.Now()
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
@@ -143,6 +232,22 @@ func (a *App) stripRedirects(t []Topic) []Topic {
|
|||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) deduplicateTopics(topics []Topic) []Topic {
|
||||||
|
seen := make(map[uint]bool)
|
||||||
|
var deduplicated []Topic
|
||||||
|
|
||||||
|
for _, topic := range topics {
|
||||||
|
if !seen[topic.TopicID] {
|
||||||
|
seen[topic.TopicID] = true
|
||||||
|
deduplicated = append(deduplicated, topic)
|
||||||
|
} else {
|
||||||
|
log.Debug().Msgf("Removing duplicate topic: %d", topic.TopicID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return deduplicated
|
||||||
|
}
|
||||||
|
|
||||||
func (a *App) isSponsor(t Topic) bool {
|
func (a *App) isSponsor(t Topic) bool {
|
||||||
return strings.HasPrefix(t.Title, "[Sponsored]")
|
return strings.HasPrefix(t.Title, "[Sponsored]")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
module github.com/davegallant/rfd-fyi
|
module github.com/davegallant/rfd-fyi
|
||||||
|
|
||||||
go 1.18
|
go 1.26
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/dlclark/regexp2 v1.11.4
|
github.com/dlclark/regexp2 v1.11.5
|
||||||
github.com/gorilla/mux v1.8.1
|
github.com/gorilla/mux v1.8.1
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/rs/zerolog v1.33.0
|
github.com/rs/zerolog v1.34.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ github.com/dlclark/regexp2 v1.11.2 h1:/u628IuisSTwri5/UKloiIsH8+qF2Pu7xEQX+yIKg6
|
|||||||
github.com/dlclark/regexp2 v1.11.2/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
github.com/dlclark/regexp2 v1.11.2/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
|
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
|
||||||
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
|
github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
|
||||||
|
github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||||
@@ -21,12 +23,15 @@ github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APP
|
|||||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
|
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
|
||||||
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
|
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
|
||||||
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||||
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
|
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
|
||||||
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||||
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
|
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
|
||||||
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||||
|
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
|
||||||
|
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||||
|
|||||||
@@ -27,3 +27,9 @@ type Offer struct {
|
|||||||
DealerName string `json:"dealer_name"`
|
DealerName string `json:"dealer_name"`
|
||||||
Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
} // @name Offer
|
} // @name Offer
|
||||||
|
|
||||||
|
type TopicDetails struct {
|
||||||
|
Topic Topic `json:"topic"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
FirstPost string `json:"first_post"`
|
||||||
|
} // @name TopicDetails
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
version: "3.9"
|
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
image: ghcr.io/davegallant/rfd-fyi-frontend
|
image: ghcr.io/davegallant/rfd-fyi-frontend
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
version: "3.9"
|
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
build:
|
build:
|
||||||
|
|||||||
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1771008912,
|
||||||
|
"narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a82ccc39b39b621151d6732718e3e250109076fa",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
51
flake.nix
Normal file
51
flake.nix
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
description = "rfd-fyi development environment";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
# Node.js LTS with npm
|
||||||
|
nodejs_20
|
||||||
|
|
||||||
|
# Go for backend
|
||||||
|
go
|
||||||
|
|
||||||
|
# Build tools
|
||||||
|
pkg-config
|
||||||
|
|
||||||
|
# Development utilities
|
||||||
|
git
|
||||||
|
curl
|
||||||
|
jq
|
||||||
|
|
||||||
|
# Optional: for better development experience
|
||||||
|
gnumake
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
echo "🚀 rfd-fyi development environment loaded"
|
||||||
|
echo "Available commands:"
|
||||||
|
echo " Frontend: npm install, npm run build, npm run serve"
|
||||||
|
echo " Backend: cd backend && CGO_ENABLED=0 go run ."
|
||||||
|
echo ""
|
||||||
|
echo "Node version: $(node --version)"
|
||||||
|
echo "npm version: $(npm --version)"
|
||||||
|
echo "Go version: $(go version)"
|
||||||
|
echo ""
|
||||||
|
echo "Tip: Run 'npm install' to install frontend dependencies"
|
||||||
|
echo "Tip: Vite is available via 'npx vite' or 'npm run build'"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
60
index.html
Normal file
60
index.html
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||||||
|
<meta name="description" content="An overlay of rfd deals" />
|
||||||
|
|
||||||
|
<!-- DNS prefetch for faster Google Fonts resolution -->
|
||||||
|
<link rel="dns-prefetch" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="dns-prefetch" href="https://fonts.gstatic.com" />
|
||||||
|
|
||||||
|
<!-- Preconnect for faster font loading -->
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
|
||||||
|
<link rel="icon" href="/favicon.png" />
|
||||||
|
|
||||||
|
<!-- Load Material Symbols font with optimal display settings -->
|
||||||
|
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<title>rfd-fyi - An overlay of hot deals</title>
|
||||||
|
|
||||||
|
<!-- Analytics - loaded async/defer so it doesn't block page -->
|
||||||
|
<script
|
||||||
|
async
|
||||||
|
defer
|
||||||
|
src="https://umami.davegallant.ca/script.js"
|
||||||
|
data-website-id="59ffe8be-509a-471e-8cd6-a63c5b35b7aa"
|
||||||
|
></script>
|
||||||
|
|
||||||
|
<!-- Theme detection script - runs before Vue loads to prevent flash of unstyled content -->
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
// Check for saved theme preference or system preference
|
||||||
|
const savedTheme = localStorage.getItem('theme');
|
||||||
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
|
const theme = savedTheme || (prefersDark ? 'dark' : 'light');
|
||||||
|
|
||||||
|
// Apply theme to html element
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme);
|
||||||
|
document.documentElement.setAttribute('data-theme', theme);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<strong
|
||||||
|
>We're sorry but rfd.fyi doesn't work properly without JavaScript
|
||||||
|
enabled. Please enable it to continue.</strong
|
||||||
|
>
|
||||||
|
</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
8643
package-lock.json
generated
8643
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
42
package.json
42
package.json
@@ -3,37 +3,37 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vite",
|
||||||
"build": "vue-cli-service build",
|
"preview": "vite preview",
|
||||||
"lint": "vue-cli-service lint"
|
"build": "vite build",
|
||||||
|
"lint": "eslint . --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@fontsource/roboto": "5.2.9",
|
||||||
"@github/hotkey": "^3.0.0",
|
"@github/hotkey": "^3.0.0",
|
||||||
|
"@mdi/font": "7.4.47",
|
||||||
"@popperjs/core": "^2.11.8",
|
"@popperjs/core": "^2.11.8",
|
||||||
"axios": "^1.6.0",
|
"axios": "^1.12.0",
|
||||||
"bootstrap": "^5.3.1",
|
|
||||||
"bootstrap-vue": "^2.22.0",
|
|
||||||
"core-js": "^3.32.1",
|
"core-js": "^3.32.1",
|
||||||
"cssnano": "^7.0.0",
|
"cssnano": "^7.0.0",
|
||||||
"jquery": "^3.7.0",
|
"dayjs": "^1.11.10",
|
||||||
"moment": "^2.29.4",
|
"vue": "^3.5.17",
|
||||||
"vue": "^3.3.4",
|
|
||||||
"vue-github-button": "^3.0.3",
|
|
||||||
"vue-gtag": "^2.0.1",
|
|
||||||
"vue-loading-overlay": "^6.0.3",
|
"vue-loading-overlay": "^6.0.3",
|
||||||
"vue-router": "4.4.3"
|
"vue-router": "^5.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.22.10",
|
"@babel/core": "^7.22.10",
|
||||||
"@babel/eslint-parser": "^7.22.10",
|
"@babel/eslint-parser": "^7.22.10",
|
||||||
"@types/bootstrap": "^5.2.6",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"@types/mousetrap": "^1.6.11",
|
|
||||||
"@vue/cli-plugin-babel": "~5.0.0",
|
"@vue/cli-plugin-babel": "~5.0.0",
|
||||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||||
"@vue/cli-service": "^5.0.8",
|
"@vue/cli-service": "^5.0.9",
|
||||||
"eslint": "^9.0.0",
|
"eslint": "^8.47.0",
|
||||||
"eslint-plugin-vue": "^9.17.0",
|
"eslint-plugin-vue": "^9.17.0",
|
||||||
"postcss-cli": "^11.0.0"
|
"postcss-cli": "^11.0.0",
|
||||||
|
"sass-embedded": "^1.89.2",
|
||||||
|
"unplugin-vue-components": "^31.0.0",
|
||||||
|
"vite": "^6.3.6"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
@@ -48,11 +48,5 @@
|
|||||||
"parser": "@babel/eslint-parser"
|
"parser": "@babel/eslint-parser"
|
||||||
},
|
},
|
||||||
"rules": {}
|
"rules": {}
|
||||||
},
|
}
|
||||||
"browserslist": [
|
|
||||||
"> 1%",
|
|
||||||
"last 2 versions",
|
|
||||||
"not dead",
|
|
||||||
"not ie 11"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.2 KiB |
@@ -1,25 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="" data-bs-theme="dark">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
|
||||||
<meta name="description" content="An overlay of rfd deals" />
|
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.png" />
|
|
||||||
<link
|
|
||||||
rel="stylesheet"
|
|
||||||
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"
|
|
||||||
/>
|
|
||||||
<title>rfd.fyi - An overlay of hot deals</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>
|
|
||||||
<strong
|
|
||||||
>We're sorry but rfd.fyi doesn't work properly without JavaScript
|
|
||||||
enabled. Please enable it to continue.</strong
|
|
||||||
>
|
|
||||||
</noscript>
|
|
||||||
<div id="app"></div>
|
|
||||||
<!-- built files will be auto injected -->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
374
src/App.vue
374
src/App.vue
@@ -1,34 +1,150 @@
|
|||||||
<script>
|
<script>
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import moment from "moment";
|
import dayjs from "dayjs";
|
||||||
import Loading from "vue-loading-overlay";
|
import utc from "dayjs/plugin/utc";
|
||||||
import GithubButton from "vue-github-button";
|
|
||||||
import { install } from "@github/hotkey";
|
|
||||||
|
|
||||||
import "vue-loading-overlay/dist/css/index.css";
|
import "vue-loading-overlay/dist/css/index.css";
|
||||||
|
import "./theme.css";
|
||||||
|
|
||||||
|
// Configure day.js with UTC support
|
||||||
|
dayjs.extend(utc);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
ascending: this.ascending,
|
ascending: this.ascending,
|
||||||
filter: window.location.href.split("filter=")[1] || "",
|
filter: window.location.href.split("filter=")[1] || "",
|
||||||
isLoading: false,
|
|
||||||
sortColumn: this.sortColumn,
|
sortColumn: this.sortColumn,
|
||||||
topics: [],
|
topics: [],
|
||||||
|
isMobile: false,
|
||||||
|
currentTheme: 'auto',
|
||||||
|
mediaQueryListener: null,
|
||||||
|
vuetifyTheme: null,
|
||||||
|
darkModeQuery: null,
|
||||||
|
themeChangeHandler: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// Install all the hotkeys on the page
|
window.addEventListener("keydown", this.handleKeyDown);
|
||||||
for (const el of document.querySelectorAll("[data-hotkey]")) {
|
this.detectMobile();
|
||||||
install(el);
|
|
||||||
}
|
|
||||||
this.sortColumn = localStorage.getItem("sortColumn") || "score";
|
|
||||||
this.ascending =
|
|
||||||
localStorage.getItem("ascending") === "false" ? false : true;
|
|
||||||
this.isLoading = true;
|
|
||||||
this.fetchDeals();
|
this.fetchDeals();
|
||||||
|
// Initialize theme on next tick
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.initializeTheme();
|
||||||
|
this.setupThemeListener();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
window.removeEventListener("keydown", this.handleKeyDown);
|
||||||
|
window.removeEventListener("resize", this.detectMobile);
|
||||||
|
if (this.darkModeQuery && this.themeChangeHandler) {
|
||||||
|
this.darkModeQuery.removeEventListener('change', this.themeChangeHandler);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
initializeTheme() {
|
||||||
|
// If no saved preference, default to auto
|
||||||
|
const savedTheme = localStorage.getItem('theme');
|
||||||
|
if (!savedTheme) {
|
||||||
|
this.currentTheme = 'auto';
|
||||||
|
this.applyTheme('auto');
|
||||||
|
} else {
|
||||||
|
this.currentTheme = savedTheme;
|
||||||
|
// Apply saved theme
|
||||||
|
this.applyTheme(savedTheme);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setupThemeListener() {
|
||||||
|
// Listen for system theme preference changes
|
||||||
|
const darkModeQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
|
|
||||||
|
this.mediaQueryListener = darkModeQuery;
|
||||||
|
|
||||||
|
// Use arrow function to preserve 'this' context
|
||||||
|
const themeChangeHandler = (e) => {
|
||||||
|
// Only auto-update theme if set to 'auto'
|
||||||
|
const savedTheme = localStorage.getItem('theme');
|
||||||
|
if (savedTheme === 'auto' || !savedTheme) {
|
||||||
|
const newTheme = e.matches ? 'dark' : 'light';
|
||||||
|
console.log('System theme changed to:', newTheme);
|
||||||
|
this.applyThemeActual(newTheme);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
darkModeQuery.addEventListener('change', themeChangeHandler);
|
||||||
|
// Store the handler so we can remove it later if needed
|
||||||
|
this.themeChangeHandler = themeChangeHandler;
|
||||||
|
this.darkModeQuery = darkModeQuery;
|
||||||
|
},
|
||||||
|
applyTheme(theme, skipSave = false) {
|
||||||
|
this.currentTheme = theme;
|
||||||
|
if (!skipSave) {
|
||||||
|
localStorage.setItem('theme', theme);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine actual theme to apply
|
||||||
|
let actualTheme = theme;
|
||||||
|
if (theme === 'auto') {
|
||||||
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
|
actualTheme = prefersDark ? 'dark' : 'light';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.applyThemeActual(actualTheme);
|
||||||
|
},
|
||||||
|
applyThemeActual(actualTheme) {
|
||||||
|
// Update data-bs-theme attribute for CSS variables to work
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', actualTheme === 'dark' ? 'dark' : 'light');
|
||||||
|
|
||||||
|
// Update HTML class for theme-based CSS selectors
|
||||||
|
if (actualTheme === 'dark') {
|
||||||
|
document.documentElement.classList.add('dark-theme');
|
||||||
|
document.documentElement.classList.remove('light-theme');
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.add('light-theme');
|
||||||
|
document.documentElement.classList.remove('dark-theme');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
toggleTheme() {
|
||||||
|
// Cycle through: auto -> light -> dark -> auto
|
||||||
|
let newTheme;
|
||||||
|
if (this.currentTheme === 'auto') {
|
||||||
|
newTheme = 'light';
|
||||||
|
} else if (this.currentTheme === 'light') {
|
||||||
|
newTheme = 'dark';
|
||||||
|
} else {
|
||||||
|
newTheme = 'auto';
|
||||||
|
}
|
||||||
|
this.applyTheme(newTheme);
|
||||||
|
},
|
||||||
|
detectMobile() {
|
||||||
|
// Detect if device is mobile/tablet based on touch capability and screen size
|
||||||
|
const hasTouch = () => {
|
||||||
|
return (
|
||||||
|
(typeof window !== "undefined" &&
|
||||||
|
("ontouchstart" in window ||
|
||||||
|
navigator.maxTouchPoints > 0 ||
|
||||||
|
navigator.msMaxTouchPoints > 0)) ||
|
||||||
|
false
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isMobileScreen = () => {
|
||||||
|
return window.innerWidth <= 1024;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.isMobile = hasTouch() || isMobileScreen();
|
||||||
|
window.addEventListener("resize", this.detectMobile);
|
||||||
|
},
|
||||||
|
handleKeyDown(event) {
|
||||||
|
const isInput = ["INPUT", "TEXTAREA"].includes(
|
||||||
|
document.activeElement.tagName
|
||||||
|
);
|
||||||
|
if (event.key === "/" && !isInput) {
|
||||||
|
event.preventDefault(); // prevent typing `/` into whatever is focused
|
||||||
|
this.$refs.filter.focus();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
createFilterRoute(params) {
|
createFilterRoute(params) {
|
||||||
this.$refs.filter.blur();
|
this.$refs.filter.blur();
|
||||||
history.pushState(
|
history.pushState(
|
||||||
@@ -38,66 +154,26 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
fetchDeals() {
|
fetchDeals() {
|
||||||
this.isLoading = true;
|
|
||||||
axios
|
axios
|
||||||
.get("api/v1/topics")
|
.get("api/v1/topics")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.topics = response.data;
|
this.topics = response.data;
|
||||||
this.isLoading = false;
|
|
||||||
this.sortTable(this.sortColumn, false);
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err.response);
|
console.log(err.response);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
sortTable: function sortTable(col, flipAscending) {
|
|
||||||
if (this.sortColumn === col && flipAscending) {
|
|
||||||
this.ascending = !this.ascending;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ascending = this.ascending;
|
|
||||||
|
|
||||||
localStorage.setItem("ascending", this.ascending);
|
|
||||||
localStorage.setItem("sortColumn", col);
|
|
||||||
this.sortColumn = col;
|
|
||||||
|
|
||||||
this.topics.sort(function (a, b) {
|
|
||||||
if (a[col] > b[col]) {
|
|
||||||
return ascending ? -1 : 1;
|
|
||||||
} else if (a[col] < b[col]) {
|
|
||||||
return ascending ? 1 : -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
isMobile() {
|
|
||||||
if (
|
|
||||||
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
||||||
navigator.userAgent
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
formatDate() {
|
formatDate() {
|
||||||
return (v) => {
|
return (v) => {
|
||||||
return moment(String(v)).format("hh:mm A z (MM/DD)");
|
const date = dayjs(String(v));
|
||||||
};
|
return date.format("YYYY-MM-DD hh:mm A");
|
||||||
},
|
|
||||||
columns() {
|
|
||||||
return {
|
|
||||||
Deal: "deal",
|
|
||||||
Score: "score",
|
|
||||||
Views: "total_views",
|
|
||||||
"Last Reply": "last_post_time",
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
filteredTopics() {
|
filteredTopics() {
|
||||||
return this.topics.filter((row) => {
|
return this.topics
|
||||||
|
.filter((row) => {
|
||||||
const titles = (
|
const titles = (
|
||||||
row.title.toString() +
|
row.title.toString() +
|
||||||
" [" +
|
" [" +
|
||||||
@@ -106,7 +182,8 @@ export default {
|
|||||||
).toLowerCase();
|
).toLowerCase();
|
||||||
const filterTerm = this.filter.toLowerCase();
|
const filterTerm = this.filter.toLowerCase();
|
||||||
return titles.includes(filterTerm);
|
return titles.includes(filterTerm);
|
||||||
});
|
})
|
||||||
|
.sort((a, b) => b.score - a.score); // Always sort by score descending
|
||||||
},
|
},
|
||||||
highlightMatches() {
|
highlightMatches() {
|
||||||
return (v) => {
|
return (v) => {
|
||||||
@@ -118,120 +195,113 @@ export default {
|
|||||||
return v.replace(re, (matchedText) => `<mark>${matchedText}</mark>`);
|
return v.replace(re, (matchedText) => `<mark>${matchedText}</mark>`);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
highlightDealerName() {
|
||||||
|
return (dealerName) => {
|
||||||
|
if (this.filter == "") return dealerName;
|
||||||
|
const matchExists = dealerName.toLowerCase().includes(this.filter.toLowerCase());
|
||||||
|
if (!matchExists) return dealerName;
|
||||||
|
|
||||||
|
const re = new RegExp(this.filter, "ig");
|
||||||
|
return dealerName.replace(re, (matchedText) => `<mark>${matchedText}</mark>`);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getThemeIcon() {
|
||||||
|
if (this.currentTheme === 'auto') {
|
||||||
|
return 'brightness_auto';
|
||||||
|
} else if (this.currentTheme === 'dark') {
|
||||||
|
return 'light_mode';
|
||||||
|
} else {
|
||||||
|
return 'dark_mode';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getThemeTitle() {
|
||||||
|
if (this.currentTheme === 'auto') {
|
||||||
|
return 'Theme: Auto (click for Light)';
|
||||||
|
} else if (this.currentTheme === 'light') {
|
||||||
|
return 'Theme: Light (click for Dark)';
|
||||||
|
} else {
|
||||||
|
return 'Theme: Dark (click for Auto)';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
Loading,
|
|
||||||
GithubButton,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<div id="app">
|
||||||
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
|
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
|
||||||
<body>
|
<div class="container">
|
||||||
|
<div class="header">
|
||||||
|
<div class="header-controls">
|
||||||
<input
|
<input
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="filter"
|
|
||||||
placeholder="Filter"
|
|
||||||
|
|
||||||
data-hotkey="/"
|
|
||||||
v-model="filter"
|
v-model="filter"
|
||||||
v-on:keyup.enter="createFilterRoute(this.filter.toString())"
|
type="text"
|
||||||
v-on:keyup.escape="this.$refs.filter.blur()"
|
placeholder="Filter deals"
|
||||||
ref="filter"
|
ref="filter"
|
||||||
|
@keyup.enter="createFilterRoute(filter.toString())"
|
||||||
|
@keyup.esc="$refs.filter.blur()"
|
||||||
|
class="search-input"
|
||||||
/>
|
/>
|
||||||
<table class="table table-hover">
|
<button @click="toggleTheme" class="theme-toggle" :title="getThemeTitle">
|
||||||
<thead class="thead text-muted">
|
<span class="material-symbols-outlined">{{ getThemeIcon }}</span>
|
||||||
<tr>
|
</button>
|
||||||
<th
|
</div>
|
||||||
v-for="(col, key) in columns"
|
</div>
|
||||||
v-on:click="sortTable(col, true)"
|
|
||||||
:key="col"
|
<div class="cards-grid">
|
||||||
>
|
|
||||||
{{ key }}
|
|
||||||
<div
|
<div
|
||||||
class="arrow"
|
v-for="topic in filteredTopics"
|
||||||
v-if="col == sortColumn"
|
:key="topic.topic_id"
|
||||||
v-bind:class="ascending ? 'arrow_up' : 'arrow_down'"
|
class="deal-card"
|
||||||
></div>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<loading
|
|
||||||
v-model:active="isLoading"
|
|
||||||
color="#ccc"
|
|
||||||
opacity="0"
|
|
||||||
loader="bars"
|
|
||||||
:is-full-page="false"
|
|
||||||
>
|
>
|
||||||
</loading>
|
<div class="card-header">
|
||||||
<tr
|
<div class="title-with-link">
|
||||||
scope="row"
|
|
||||||
v-for="(topic, index) in filteredTopics"
|
|
||||||
:key="`topic.topic_id-${index}`"
|
|
||||||
>
|
|
||||||
<td scope="col">
|
|
||||||
<a
|
<a
|
||||||
:href="`https://forums.redflagdeals.com${topic.web_path}`"
|
:href="`https://forums.redflagdeals.com${topic.web_path}`"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
v-html="
|
class="deal-title"
|
||||||
highlightMatches(
|
@click.stop
|
||||||
topic.title + ' [' + topic.Offer.dealer_name + '] '
|
v-html="highlightMatches(topic.title)"
|
||||||
)
|
|
||||||
"
|
|
||||||
></a>
|
></a>
|
||||||
<a
|
<a
|
||||||
:href="`${topic.Offer.url}`"
|
|
||||||
target="_blank"
|
|
||||||
v-if="topic.Offer.url"
|
v-if="topic.Offer.url"
|
||||||
><span class="material-symbols-outlined"> link </span></a
|
:href="topic.Offer.url"
|
||||||
>
|
target="_blank"
|
||||||
<span v-if="!topic.Offer.url" class="material-symbols-outlined">
|
class="card-link"
|
||||||
link_off
|
title="Open deal"
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td v-if="topic.score > 0" scope="col" class="green-score">
|
|
||||||
+{{ topic.score }}
|
|
||||||
</td>
|
|
||||||
<td v-if="topic.score < 0" scope="col" class="red-score">
|
|
||||||
{{ topic.score }}
|
|
||||||
</td>
|
|
||||||
<td v-if="topic.score == 0" scope="col">
|
|
||||||
{{ topic.score }}
|
|
||||||
</td>
|
|
||||||
<td scope="col">{{ topic.total_views }}</td>
|
|
||||||
<td scope="col">{{ formatDate(topic.last_post_time) }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<div v-if="!isMobile()">
|
|
||||||
<footer class="fixed-bottom">
|
|
||||||
<small
|
|
||||||
>Press '/' to begin filtering (i.e.
|
|
||||||
<a
|
|
||||||
href="/#/filter=costco"
|
|
||||||
onclick="setTimeout(location.reload.bind(location), 1)"
|
|
||||||
>https://rfd.fyi/#/filter=costco</a
|
|
||||||
>)</small
|
|
||||||
>
|
|
||||||
<div class="footer-right">
|
|
||||||
<github-button href="https://github.com/davegallant/rfd-fyi"
|
|
||||||
>Star</github-button
|
|
||||||
>
|
>
|
||||||
|
<span class="material-symbols-outlined">open_in_new</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="score-bubble" :class="{ positive: topic.score > 0, negative: topic.score < 0, neutral: topic.score === 0 }">
|
||||||
|
<span v-if="topic.score > 0">+{{ topic.score }}</span>
|
||||||
|
<span v-else>{{ topic.score }}</span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style>
|
<div class="card-meta">
|
||||||
#app {
|
<span class="dealer-name" v-html="highlightDealerName(topic.Offer.dealer_name)"></span>
|
||||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
</div>
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
<div class="card-details">
|
||||||
text-align: center;
|
<div class="details-stats">
|
||||||
color: #2c3e50;
|
<div class="stat">
|
||||||
}
|
<span class="material-symbols-outlined">visibility</span>
|
||||||
</style>
|
<span class="stat-value">{{ topic.total_views }} views</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat">
|
||||||
|
<span class="material-symbols-outlined">chat</span>
|
||||||
|
<span class="stat-value">{{ topic.total_replies }} replies</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-timestamp">
|
||||||
|
Last post: {{ formatDate(topic.last_post_time) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|||||||
15
src/main.js
15
src/main.js
@@ -1,23 +1,22 @@
|
|||||||
import { createApp } from "vue";
|
import { createApp } from "vue";
|
||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
import VueGtag from "vue-gtag";
|
|
||||||
import { createRouter, createWebHashHistory } from "vue-router";
|
import { createRouter, createWebHashHistory } from "vue-router";
|
||||||
|
|
||||||
import "bootstrap/dist/css/bootstrap.min.css";
|
|
||||||
import "bootstrap/dist/js/bootstrap.min.js";
|
|
||||||
|
|
||||||
import "./theme.css";
|
import "./theme.css";
|
||||||
|
|
||||||
const routes = [];
|
const routes = [
|
||||||
|
{
|
||||||
|
path: '/:pathMatch(.*)*',
|
||||||
|
component: App,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHashHistory(),
|
history: createWebHashHistory(),
|
||||||
routes,
|
routes,
|
||||||
});
|
});
|
||||||
|
|
||||||
const app = createApp(App).use(VueGtag, {
|
const app = createApp(App);
|
||||||
config: { id: "G-YF11ZH9SYD" },
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
435
src/theme.css
435
src/theme.css
@@ -1,10 +1,58 @@
|
|||||||
body {
|
.material-symbols-outlined {
|
||||||
max-width: 100%;
|
font-family: 'Material Symbols Outlined';
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
font-size: 24px;
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: normal;
|
||||||
|
text-transform: none;
|
||||||
|
display: inline-block;
|
||||||
|
white-space: nowrap;
|
||||||
|
word-wrap: normal;
|
||||||
|
direction: ltr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thead {
|
/* Theme-aware CSS variables */
|
||||||
position: sticky;
|
:root {
|
||||||
top: 0;
|
/* Light theme (default) */
|
||||||
|
--bg-primary: #dddddd;
|
||||||
|
--bg-secondary: #e8e8e8;
|
||||||
|
--text-primary: #212529;
|
||||||
|
--text-secondary: #6c757d;
|
||||||
|
--border-color: #d0d0d0;
|
||||||
|
--link-color: #212529;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark theme */
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--bg-primary: #1a1a1a;
|
||||||
|
--bg-secondary: #2a2a2a;
|
||||||
|
--text-primary: #e0e0e0;
|
||||||
|
--text-secondary: #a0a0a0;
|
||||||
|
--border-color: #3a3a3a;
|
||||||
|
--link-color: #212529;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Support for explicit data-bs-theme attribute (Bootstrap override) */
|
||||||
|
html[data-bs-theme="dark"] {
|
||||||
|
--bg-primary: #1a1a1a;
|
||||||
|
--bg-secondary: #2a2a2a;
|
||||||
|
--text-primary: #e0e0e0;
|
||||||
|
--text-secondary: #a0a0a0;
|
||||||
|
--border-color: #3a3a3a;
|
||||||
|
--link-color: #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-bs-theme="light"],
|
||||||
|
html.light-theme {
|
||||||
|
--bg-primary: #dddddd;
|
||||||
|
--bg-secondary: #e8e8e8;
|
||||||
|
--text-primary: #212529;
|
||||||
|
--text-secondary: #6c757d;
|
||||||
|
--border-color: #d0d0d0;
|
||||||
|
--link-color: #212529;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@@ -12,57 +60,352 @@ html {
|
|||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
-webkit-text-size-adjust: 100%;
|
-webkit-text-size-adjust: 100%;
|
||||||
-ms-text-size-adjust: 100%;
|
-ms-text-size-adjust: 100%;
|
||||||
|
background-color: var(--bg-primary);
|
||||||
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
body {
|
||||||
color: #96ada5; /**/
|
max-width: 100%;
|
||||||
}
|
background-color: var(--bg-primary);
|
||||||
a:visited {
|
color: var(--text-primary);
|
||||||
color: #53514f; /**/
|
transition: background-color 0.3s ease, color 0.3s ease;
|
||||||
}
|
margin: 0;
|
||||||
a:hover {
|
padding: 0;
|
||||||
color: #d65d03; /**/
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
background: #212529;
|
|
||||||
color: white;
|
|
||||||
padding: 3px;
|
|
||||||
padding-right: 10px;
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-left {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-right {
|
|
||||||
float: right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.green-score {
|
.green-score {
|
||||||
color: rgb(22, 120, 63) !important;
|
color: rgb(34, 139, 34) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-bs-theme="light"] .green-score {
|
||||||
|
color: rgb(34, 139, 34) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-bs-theme="dark"] .green-score {
|
||||||
|
color: rgb(158, 206, 106) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.red-score {
|
.red-score {
|
||||||
color: rgb(175, 21, 21) !important;
|
color: rgb(247, 118, 142) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow_down {
|
a {
|
||||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAaCAYAAABPY4eKAAAAAXNSR0IArs4c6QAAAvlJREFUSA29Vk1PGlEUHQaiiewslpUJiyYs2yb9AyRuJGm7c0VJoFXSX9A0sSZN04ULF12YEBQDhMCuSZOm1FhTiLY2Rky0QPlQBLRUsICoIN/0PCsGyox26NC3eTNn3r3n3TvnvvsE1PkwGo3yUqkkEQqFgw2Mz7lWqwng7ztN06mxsTEv8U0Aam5u7r5EInkplUol/f391wAJCc7nEAgE9Uwmkzo4OPiJMa1Wq6cFs7Ozt0H6RqlUDmJXfPIx+qrX69Ti4mIyHA5r6Wq1egND+j+IyW6QAUoul18XiUTDNHaSyGazKcZtdgk8wqhUKh9o/OMvsVgsfHJy0iWqVrcQNRUMBnd6enqc9MjISAmRP3e73T9al3XnbWNjIw2+KY1Gc3imsNHR0YV4PP5+d3e32h3K316TySQFoX2WyWR2glzIO5fLTSD6IElLNwbqnFpbWyO/96lCoai0cZjN5kfYQAYi5H34fL6cxWIZbya9iJyAhULBHAqFVlMpfsV/fHxMeb3er+Vy+VUzeduzwWC45XA4dlD/vEXvdDrj8DvURsYEWK3WF4FA4JQP9mg0WrHZbEYmnpa0NxYgPVObm5teiLABdTQT8a6vrwdRWhOcHMzMzCiXlpb2/yV6qDttMpkeshEzRk4Wo/bfoe4X9vb2amzGl+HoXNT29vZqsVi0sK1jJScG+Xx+HGkL4Tew2TPi5zUdQQt9otPpuBk3e0TaHmMDh1zS7/f780S0zX6Yni+NnBj09fUZUfvudDrNZN+GkQbl8Xi8RLRtHzsB9Hr9nfn5+SjSeWUCXC7XPq5kw53wsNogjZNohYXL2EljstvtrAL70/mVaW8Y4OidRO1/gwgbUMvcqGmcDc9aPvD1gnTeQ+0nmaInokRj0nHh+uvIiVOtVvt2a2vLv7Ky0tL3cRTXIcpPAwMDpq6R4/JXE4vFQ5FI5CN+QTaRSFCYc8vLy1l0rge4ARe5kJ/d27kYkLXoy2Jo4C7K8CZOsEBvb+9rlUp1xNXPL7v3IDwxvPD6AAAAAElFTkSuQmCC");
|
color: var(--link-color);
|
||||||
}
|
transition: color 0.2s ease;
|
||||||
.arrow_up {
|
|
||||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAaCAYAAACgoey0AAAAAXNSR0IArs4c6QAAAwpJREFUSA21Vt1PUmEYP4dvkQ8JFMwtBRocWAkDbiqXrUWXzU1rrTt0bdVqXbb1tbW16C9IBUSmm27cODdneoXjputa6069qwuW6IIBIdLvdaF4OAcOiGeDc87zPs/vd57P96WpFq7p6enbGo1mjKZpeTabjU1MTCRagGnOZHFxcXxtbe1XKpUq7+zslJeXl//Mz8+Hy+Uy3RxSE9qTk5M3otFooVQqgef4Wl9f343FYoEmoISrxuNxFX5f9vb2jhn/PxUKhfLS0tIPfFifUESRUMV8Pv/M6XReRm5rTGQyGeXxeGxYe1ezeBpBOBx2rKysbO7v79d4Wy3Y2Nj4GQqFbgnhaugxwiuGJx99Pp9FLBbXxYTXvTqd7v3MzIy6riIWGxJnMpl7AwMD14xGYyMsSq1WUyQdUqn0eSPlusQIsbGrq+vl4OCgvhFQZd1utyv1en0gEolcqsi47nWJlUrlG5fLZVcoFFy2nDKSDpIWlUoVTCQSEk4lCHmJMZ2GTCbTiMVikfIZ88l7enoos9l8dXt7+z6fDicxSJUokqDX6xXcl2wCROoc0vQCWL3sNfLOSdzR0fHY4XC4tVotl40gmVwup9xuN4OQv+UyqCFGH9rg7SOGYVRcBs3IEG4J0nVnamrqOtvuBDGGgQg9+wHFcVEi4a0LNkbdd6TrPKo8ODc311mteIIYjT/a398/jK+s1jnVM0kXoufCFvq0GuiIGEVgQIhfoygM1QrteEa9dAL7ITiYCt4RMabOK5AyKKzKWtvupLcRciu8D5J0EuDDPyT/Snd39yh6VtY2NhYQSR9G79Ds7OxdskRjEyAufvb7/cPoO5Z6e1+xtVKrq6vfcFzyi/A3ZrPZ3GdNSlwgo5ekE4X2RIQGf2C1WlufFE0GBeGWYQ8YERWLxQtnUVB830MKLZfL9RHir8lkssCn2G751tZWEWe03zTKm15YWPiEiXXTYDB0Ig/t7yd8PRws4EicwWHxO4jHD8/C5HiTTqd1BwcHFozKU89origB+y/kmzgYpgOBQP4fGmUiZmJ+WNgAAAAASUVORK5CYII=");
|
|
||||||
}
|
|
||||||
.arrow {
|
|
||||||
float: right;
|
|
||||||
width: 10px;
|
|
||||||
height: 12px;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: contain;
|
|
||||||
background-position-y: bottom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-symbols-outlined {
|
a:visited {
|
||||||
font-size: medium;
|
color: var(--link-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* App styles */
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 20px;
|
||||||
|
background-color: var(--bg-primary);
|
||||||
|
color: var(--text-primary);
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-controls {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
flex: 1;
|
||||||
|
max-width: 500px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
color: var(--text-primary);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #999999;
|
||||||
|
background-color: #ffffff;
|
||||||
|
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
html.dark-theme .search-input {
|
||||||
|
border-color: #555555;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
color: #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html.dark-theme .search-input:focus {
|
||||||
|
background-color: #2a2a2a;
|
||||||
|
border-color: #777777;
|
||||||
|
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input::placeholder {
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
color: var(--text-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
font-size: 18px;
|
||||||
|
padding: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:hover {
|
||||||
|
background-color: #e8e8e8;
|
||||||
|
border-color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
html.dark-theme .theme-toggle {
|
||||||
|
border-color: #555555;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
color: #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html.dark-theme .theme-toggle:hover {
|
||||||
|
background-color: #2a2a2a;
|
||||||
|
border-color: #777777;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cards-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
||||||
|
gap: 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deal-card {
|
||||||
|
background-color: var(--bg-secondary);
|
||||||
|
border: 1.5px solid #aaaaaa;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deal-card:hover {
|
||||||
|
background-color: #15151515;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
border-color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-with-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 6px;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deal-title {
|
||||||
|
color: var(--link-color);
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1.4;
|
||||||
|
flex: 1;
|
||||||
|
transition: color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deal-title:visited {
|
||||||
|
color: var(--link-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.deal-title:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-meta {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dealer-name {
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-timestamp {
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 12px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--link-color);
|
||||||
|
text-decoration: none;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-link:hover {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-link .material-symbols-outlined {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-bubble {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 50px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 12px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
padding: 0 8px;
|
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-bubble.positive {
|
||||||
|
background-color: rgb(34, 139, 34);
|
||||||
|
color: white;
|
||||||
|
box-shadow: 0 1px 3px rgba(34, 139, 34, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
html.light-theme .score-bubble.positive {
|
||||||
|
background-color: rgb(34, 139, 34);
|
||||||
|
color: white;
|
||||||
|
box-shadow: 0 1px 3px rgba(34, 139, 34, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
html.dark-theme .score-bubble.positive {
|
||||||
|
background-color: rgb(158, 206, 106);
|
||||||
|
color: #1a1a1a;
|
||||||
|
box-shadow: 0 1px 3px rgba(158, 206, 106, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-bubble.negative {
|
||||||
|
background-color: rgb(247, 118, 142);
|
||||||
|
color: white;
|
||||||
|
box-shadow: 0 1px 3px rgba(247, 118, 142, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-bubble.neutral {
|
||||||
|
background-color: var(--text-secondary);
|
||||||
|
color: var(--bg-primary);
|
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-details {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-stats {
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat .material-symbols-outlined {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-section {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-section strong {
|
||||||
|
display: block;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-section p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.4;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile responsive */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.cards-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mark highlighting */
|
||||||
|
mark {
|
||||||
|
background-color: rgba(255, 193, 7, 0.3);
|
||||||
|
color: inherit;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
html.dark-theme mark {
|
||||||
|
background-color: rgba(255, 193, 7, 0.4);
|
||||||
|
color: inherit;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|||||||
70
vite.config.mjs
Normal file
70
vite.config.mjs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
// Plugins
|
||||||
|
import Components from "unplugin-vue-components/vite";
|
||||||
|
import Vue from "@vitejs/plugin-vue";
|
||||||
|
|
||||||
|
// Utilities
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
import { fileURLToPath, URL } from "node:url";
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
Vue(),
|
||||||
|
Components(),
|
||||||
|
],
|
||||||
|
define: { "process.env": {} },
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": fileURLToPath(new URL("src", import.meta.url)),
|
||||||
|
},
|
||||||
|
extensions: [".js", ".json", ".jsx", ".mjs", ".ts", ".tsx", ".vue"],
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
port: 3000,
|
||||||
|
proxy: {
|
||||||
|
"/api": "http://localhost:8080",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
css: {
|
||||||
|
preprocessorOptions: {
|
||||||
|
sass: {
|
||||||
|
api: "modern-compiler",
|
||||||
|
},
|
||||||
|
scss: {
|
||||||
|
api: "modern-compiler",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
target: "esnext",
|
||||||
|
minify: "terser",
|
||||||
|
terserOptions: {
|
||||||
|
compress: {
|
||||||
|
drop_console: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
manualChunks: {
|
||||||
|
"vendor": ["axios", "dayjs", "vue-router", "vue-loading-overlay"],
|
||||||
|
},
|
||||||
|
chunkFileNames: "js/[name].[hash].js",
|
||||||
|
entryFileNames: "js/[name].[hash].js",
|
||||||
|
assetFileNames: (assetInfo) => {
|
||||||
|
const info = assetInfo.name.split(".");
|
||||||
|
const ext = info[info.length - 1];
|
||||||
|
if (/png|jpe?g|gif|tiff|bmp|ico/i.test(ext)) {
|
||||||
|
return `images/[name].[hash][extname]`;
|
||||||
|
} else if (/woff|woff2|eot|ttf|otf/i.test(ext)) {
|
||||||
|
return `fonts/[name].[hash][extname]`;
|
||||||
|
} else if (ext === "css") {
|
||||||
|
return `css/[name].[hash][extname]`;
|
||||||
|
}
|
||||||
|
return `[name].[hash][extname]`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
chunkSizeWarningLimit: 1000,
|
||||||
|
reportCompressedSize: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
const { defineConfig } = require("@vue/cli-service");
|
|
||||||
module.exports = defineConfig({
|
|
||||||
transpileDependencies: true,
|
|
||||||
devServer: {
|
|
||||||
proxy: "http://localhost:8080",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user