mirror of
https://github.com/davegallant/rfd-fyi.git
synced 2026-03-03 17:46:35 +00:00
Compare commits
3 Commits
renovate/v
...
renovate/m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bea32bc3b2 | ||
|
|
0901010aff | ||
|
|
efd69575c3 |
@@ -1,4 +0,0 @@
|
|||||||
> 1%
|
|
||||||
last 2 versions
|
|
||||||
not dead
|
|
||||||
not ie 11
|
|
||||||
@@ -1,4 +1 @@
|
|||||||
node_modules
|
backend
|
||||||
dist
|
|
||||||
.git
|
|
||||||
.github
|
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
dist/
|
|
||||||
node_modules/
|
|
||||||
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@v6
|
uses: actions/checkout@v4
|
||||||
- name: 'Dependency Review'
|
- name: 'Dependency Review'
|
||||||
uses: actions/dependency-review-action@v4
|
uses: actions/dependency-review-action@v4
|
||||||
|
|||||||
50
.github/workflows/publish-container.yml
vendored
50
.github/workflows/publish-container.yml
vendored
@@ -1,50 +0,0 @@
|
|||||||
name: Publish Container
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 0 * * 0"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
name: Publish rfd-fyi
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Prepare
|
|
||||||
id: prep
|
|
||||||
run: |
|
|
||||||
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/rfd-fyi
|
|
||||||
VERSION=${GITHUB_REF##*/}
|
|
||||||
if [[ $GITHUB_REF == refs/heads/main ]]; then
|
|
||||||
VERSION=latest
|
|
||||||
fi
|
|
||||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
||||||
VERSION=${GITHUB_REF#refs/tags/v}
|
|
||||||
fi
|
|
||||||
TAGS="${IMAGE_NAME}:${VERSION}"
|
|
||||||
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
|
||||||
TAGS="$TAGS,${IMAGE_NAME}:latest"
|
|
||||||
fi
|
|
||||||
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to GitHub Packages Docker Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build / push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: ${{ github.ref == 'refs/heads/main' }}
|
|
||||||
tags: ${{ steps.prep.outputs.tags }}
|
|
||||||
87
.github/workflows/publish-containers.yml
vendored
Normal file
87
.github/workflows/publish-containers.yml
vendored
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
name: Publish Containers
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-backend:
|
||||||
|
name: Publish rfd-fyi-backend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
id: prep
|
||||||
|
run: |
|
||||||
|
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/rfd-fyi-backend
|
||||||
|
VERSION=${GITHUB_REF##*/}
|
||||||
|
if [[ $GITHUB_REF == refs/heads/main ]]; then
|
||||||
|
VERSION=latest
|
||||||
|
fi
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
|
fi
|
||||||
|
TAGS="${IMAGE_NAME}:${VERSION}"
|
||||||
|
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||||
|
TAGS="$TAGS,${IMAGE_NAME}:latest"
|
||||||
|
fi
|
||||||
|
echo ::set-output name=tags::${TAGS}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to GitHub Packages Docker Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build / push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: backend
|
||||||
|
file: ./backend/Dockerfile
|
||||||
|
push: ${{ github.ref == 'refs/heads/main' }}
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
|
|
||||||
|
publish-frontend:
|
||||||
|
name: Publish rfd-fyi-frontend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
id: prep
|
||||||
|
run: |
|
||||||
|
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/rfd-fyi-frontend
|
||||||
|
VERSION=${GITHUB_REF##*/}
|
||||||
|
if [[ $GITHUB_REF == refs/heads/main ]]; then
|
||||||
|
VERSION=latest
|
||||||
|
fi
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
|
fi
|
||||||
|
TAGS="${IMAGE_NAME}:${VERSION}"
|
||||||
|
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||||
|
TAGS="$TAGS,${IMAGE_NAME}:latest"
|
||||||
|
fi
|
||||||
|
echo ::set-output name=tags::${TAGS}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to GitHub Packages Docker Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build / push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: ${{ github.ref == 'refs/heads/main' }}
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,9 +1,7 @@
|
|||||||
node_modules
|
node_modules
|
||||||
/dist
|
dist
|
||||||
data/
|
data/
|
||||||
backend/bin/
|
backend/bin/
|
||||||
.vscode
|
.vscode
|
||||||
*.pem
|
*.pem
|
||||||
.env
|
.env
|
||||||
.direnv
|
|
||||||
.envrc.local
|
|
||||||
|
|||||||
5
Caddyfile
Normal file
5
Caddyfile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
rfd.fyi
|
||||||
|
|
||||||
|
file_server
|
||||||
|
|
||||||
|
reverse_proxy /api/* backend:8080
|
||||||
24
Dockerfile
24
Dockerfile
@@ -1,20 +1,20 @@
|
|||||||
# Build frontend
|
FROM node:20.2.0-alpine3.16 AS builder
|
||||||
FROM dhi.io/node:25-debian13-dev AS frontend-builder
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Build backend (with embedded frontend)
|
FROM caddy:2.8.4-alpine AS runtime
|
||||||
FROM dhi.io/golang:1.26-debian13-dev AS backend-builder
|
|
||||||
WORKDIR /src
|
|
||||||
COPY backend /src
|
|
||||||
COPY --from=frontend-builder /app/dist /src/dist
|
|
||||||
RUN CGO_ENABLED=0 go build -o rfd-fyi .
|
|
||||||
|
|
||||||
FROM dhi.io/static:20251003-musl-alpine3.23 AS runtime
|
WORKDIR /my-site
|
||||||
COPY --from=backend-builder /src/rfd-fyi /rfd-fyi
|
|
||||||
|
COPY --from=builder /app/dist ./
|
||||||
|
|
||||||
|
COPY Caddyfile /etc/caddy/Caddyfile
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
ENTRYPOINT ["/rfd-fyi"]
|
|
||||||
|
|||||||
22
Makefile
22
Makefile
@@ -15,29 +15,29 @@ help:
|
|||||||
|
|
||||||
## backend: Build and run the backend from source
|
## backend: Build and run the backend from source
|
||||||
backend:
|
backend:
|
||||||
@cd backend && CGO_ENABLED=0 HTTP_PORT=8080 go run .
|
@cd backend && 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 run serve
|
@npm install @vue/cli-service
|
||||||
|
@npx vue-cli-service serve
|
||||||
.PHONY: frontend
|
.PHONY: frontend
|
||||||
|
|
||||||
## dev: Build and run in Docker
|
## dev: Build and run in docker compose
|
||||||
dev:
|
dev:
|
||||||
docker build -t rfd-fyi:dev .
|
docker compose up --build -d
|
||||||
docker run -d --name rfd-fyi -p 8080:8080 rfd-fyi:dev
|
|
||||||
.PHONY: dev
|
.PHONY: dev
|
||||||
|
|
||||||
## prod: Run the latest image in Docker
|
## prod: Run the latest images in docker compose
|
||||||
prod:
|
prod:
|
||||||
@git pull
|
@git pull
|
||||||
@docker pull ghcr.io/davegallant/rfd-fyi
|
@docker pull ghcr.io/davegallant/rfd-fyi-backend
|
||||||
@docker run -d --name rfd-fyi -p 8080:8080 ghcr.io/davegallant/rfd-fyi
|
@docker pull ghcr.io/davegallant/rfd-fyi-frontend
|
||||||
|
@docker compose -f docker-compose.prod.yml up -d
|
||||||
.PHONY: prod
|
.PHONY: prod
|
||||||
|
|
||||||
## teardown: Teardown Docker
|
## teardown: Teardown docker
|
||||||
teardown:
|
teardown:
|
||||||
docker stop rfd-fyi || true
|
docker compose down
|
||||||
docker rm rfd-fyi || true
|
|
||||||
.PHONY: teardown
|
.PHONY: teardown
|
||||||
|
|||||||
34
README.md
34
README.md
@@ -1,33 +1,35 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
## Docker
|
It is hosted at [rfd.fyi](https://rfd.fyi).
|
||||||
|
|
||||||
To run the latest:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
docker run -d --name rfd-fyi -p 8080:8080 ghcr.io/davegallant/rfd-fyi
|
|
||||||
```
|
|
||||||
|
|
||||||
To build container from source:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
make dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## Local Development
|
## Local Development
|
||||||
|
|
||||||
To get up and running locally: in one shell, run:
|
To get up and running locally: in one pane/tab, run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make backend
|
make backend
|
||||||
```
|
```
|
||||||
|
|
||||||
In another shell, run:
|
In another pane/tab, run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make frontend
|
make frontend
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Docker Compose
|
||||||
|
|
||||||
|
To build containers from source:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make dev
|
||||||
|
```
|
||||||
|
|
||||||
|
To run the latest published images:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make prod
|
||||||
|
```
|
||||||
|
|||||||
16
backend/Dockerfile
Normal file
16
backend/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# syntax=docker/dockerfile:1.9
|
||||||
|
FROM cgr.dev/chainguard/go:latest as build
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
COPY . /src
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=0 go build -o backend .
|
||||||
|
|
||||||
|
FROM cgr.dev/chainguard/static:latest
|
||||||
|
|
||||||
|
COPY --from=build /src/backend /backend
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD [ "/backend" ]
|
||||||
204
backend/app.go
204
backend/app.go
@@ -1,12 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io/ioutil"
|
||||||
"io/fs"
|
"math/rand"
|
||||||
"math/rand/v2"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -19,8 +17,20 @@ import (
|
|||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed dist/*
|
// @title RFD FYI API
|
||||||
var frontendFS embed.FS
|
// @version 1.0
|
||||||
|
// @description An API for issue tracking
|
||||||
|
// @termsOfService http://swagger.io/terms/
|
||||||
|
|
||||||
|
// @contact.name API Support
|
||||||
|
// @contact.url https://linktr.ee/davegallant
|
||||||
|
// @contact.email davegallant@gmail.com
|
||||||
|
|
||||||
|
// @license.name Apache 2.0
|
||||||
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
// @host localhost:8080
|
||||||
|
// @BasePath /api/v1
|
||||||
|
|
||||||
type App struct {
|
type App struct {
|
||||||
Router *mux.Router
|
Router *mux.Router
|
||||||
@@ -38,45 +48,21 @@ type Redirect struct {
|
|||||||
func (a *App) Initialize() {
|
func (a *App) Initialize() {
|
||||||
a.BasePath = "/api/v1"
|
a.BasePath = "/api/v1"
|
||||||
|
|
||||||
a.Router = mux.NewRouter()
|
a.Router = mux.NewRouter().PathPrefix(a.BasePath).Subrouter()
|
||||||
|
http.Handle("/", a.Router)
|
||||||
|
|
||||||
a.initializeRoutes()
|
a.initializeRoutes()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) Run(httpPort string) {
|
func (a *App) Run(httpPort string) {
|
||||||
log.Info().Msgf("Serving requests on port " + httpPort)
|
log.Info().Msgf("Serving requests on port " + httpPort)
|
||||||
if err := http.ListenAndServe(fmt.Sprintf(":%s", httpPort), a.Router); err != nil {
|
if err := http.ListenAndServe(fmt.Sprintf(":"+httpPort), nil); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) initializeRoutes() {
|
func (a *App) initializeRoutes() {
|
||||||
a.Router.HandleFunc(a.BasePath+"/topics", a.listTopics).Methods("GET")
|
a.Router.HandleFunc("/topics", a.listTopics).Methods("GET")
|
||||||
a.Router.HandleFunc(a.BasePath+"/topics/{id}", a.getTopicDetails).Methods("GET")
|
|
||||||
|
|
||||||
distFS, err := fs.Sub(frontendFS, "dist")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
fileServer := http.FileServer(http.FS(distFS))
|
|
||||||
a.Router.PathPrefix("/").Handler(spaHandler{staticHandler: fileServer, staticFS: distFS})
|
|
||||||
}
|
|
||||||
|
|
||||||
// spaHandler serves static files when they exist, otherwise falls back to
|
|
||||||
// index.html so that client-side routing works.
|
|
||||||
type spaHandler struct {
|
|
||||||
staticHandler http.Handler
|
|
||||||
staticFS fs.FS
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h spaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
||||||
path := strings.TrimPrefix(r.URL.Path, "/")
|
|
||||||
if path == "" {
|
|
||||||
path = "index.html"
|
|
||||||
}
|
|
||||||
if _, err := fs.Stat(h.staticFS, path); err != nil {
|
|
||||||
r.URL.Path = "/"
|
|
||||||
}
|
|
||||||
h.staticHandler.ServeHTTP(w, r)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// func respondWithError(w http.ResponseWriter, code int, message string) {
|
// func respondWithError(w http.ResponseWriter, code int, message string) {
|
||||||
@@ -95,150 +81,26 @@ func respondWithJSON(w http.ResponseWriter, code int, payload interface{}) {
|
|||||||
// @Summary Lists all topics stored in the database
|
// @Summary Lists all topics stored in the database
|
||||||
// @Description All topics will be listed. There is currently no pagination implemented.
|
// @Description All topics will be listed. There is currently no pagination implemented.
|
||||||
// @ID list-topics
|
// @ID list-topics
|
||||||
// @Param filters query string false "JSON array of filter strings"
|
|
||||||
// @Router /topics [get]
|
// @Router /topics [get]
|
||||||
// @Success 200 {array} Topic
|
// @Success 200 {array} Topic
|
||||||
func (a *App) listTopics(w http.ResponseWriter, r *http.Request) {
|
func (a *App) listTopics(w http.ResponseWriter, r *http.Request) {
|
||||||
filtersParam := r.URL.Query().Get("filters")
|
|
||||||
|
|
||||||
if filtersParam == "" {
|
|
||||||
respondWithJSON(w, http.StatusOK, a.CurrentTopics)
|
respondWithJSON(w, http.StatusOK, a.CurrentTopics)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var filters []string
|
|
||||||
err := json.Unmarshal([]byte(filtersParam), &filters)
|
|
||||||
if err != nil {
|
|
||||||
log.Warn().Msgf("could not parse filters parameter: %s", err)
|
|
||||||
respondWithJSON(w, http.StatusOK, a.CurrentTopics)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(filters) == 0 {
|
|
||||||
respondWithJSON(w, http.StatusOK, a.CurrentTopics)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter topics
|
|
||||||
var filteredTopics []Topic
|
|
||||||
for _, topic := range a.CurrentTopics {
|
|
||||||
searchText := strings.ToLower(topic.Title + " [" + topic.Offer.DealerName + "]")
|
|
||||||
matchesAll := true
|
|
||||||
for _, filter := range filters {
|
|
||||||
if !strings.Contains(searchText, strings.ToLower(filter)) {
|
|
||||||
matchesAll = false
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if matchesAll {
|
|
||||||
filteredTopics = append(filteredTopics, topic)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
respondWithJSON(w, http.StatusOK, filteredTopics)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 := io.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()
|
||||||
time.Sleep(time.Duration(rand.IntN(90-60+1)+60) * time.Second)
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
time.Sleep(time.Duration(rand.Intn(90-60+1)+60) * time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,22 +143,6 @@ 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]")
|
||||||
}
|
}
|
||||||
@@ -311,7 +157,7 @@ func (a *App) getDeals(id int, firstPage int, lastPage int) []Topic {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Msgf("error fetching deals: %s\n", err)
|
log.Warn().Msgf("error fetching deals: %s\n", err)
|
||||||
}
|
}
|
||||||
body, err := io.ReadAll(res.Body)
|
body, err := ioutil.ReadAll(res.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Msgf("could not read response body: %s\n", err)
|
log.Warn().Msgf("could not read response body: %s\n", err)
|
||||||
}
|
}
|
||||||
@@ -341,7 +187,7 @@ func (a *App) getRedirects() []Redirect {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Msgf("error fetching redirects: %s\n", err)
|
log.Warn().Msgf("error fetching redirects: %s\n", err)
|
||||||
}
|
}
|
||||||
body, err := io.ReadAll(res.Body)
|
body, err := ioutil.ReadAll(res.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Msgf("could not read response body: %s\n", err)
|
log.Warn().Msgf("could not read response body: %s\n", err)
|
||||||
}
|
}
|
||||||
|
|||||||
6
backend/dist/index.html
vendored
6
backend/dist/index.html
vendored
@@ -1,6 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<p>Run the Vite dev server for the frontend.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
module github.com/davegallant/rfd-fyi
|
module github.com/davegallant/rfd-fyi
|
||||||
|
|
||||||
go 1.26
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/dlclark/regexp2 v1.11.5
|
github.com/dlclark/regexp2 v1.11.4
|
||||||
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.34.0
|
github.com/rs/zerolog v1.33.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ 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=
|
||||||
@@ -23,15 +21,12 @@ 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=
|
||||||
|
|||||||
@@ -11,6 +11,21 @@ import (
|
|||||||
utils "github.com/davegallant/rfd-fyi/pkg/utils"
|
utils "github.com/davegallant/rfd-fyi/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// @title RFD FYI API
|
||||||
|
// @version 1.0
|
||||||
|
// @description An API for an issue tracking service
|
||||||
|
// @termsOfService http://swagger.io/terms/
|
||||||
|
|
||||||
|
// @contact.name API Support
|
||||||
|
// @contact.url http://www.swagger.io/support
|
||||||
|
// @contact.email support@swagger.io
|
||||||
|
|
||||||
|
// @license.name Apache 2.0
|
||||||
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
// @host localhost:8080
|
||||||
|
// @BasePath /api/v1
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,3 @@ 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
|
|
||||||
|
|||||||
17
docker-compose.prod.yml
Normal file
17
docker-compose.prod.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
version: "3.9"
|
||||||
|
services:
|
||||||
|
frontend:
|
||||||
|
image: ghcr.io/davegallant/rfd-fyi-frontend
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
links:
|
||||||
|
- "backend:backend"
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
restart: always
|
||||||
|
backend:
|
||||||
|
image: ghcr.io/davegallant/rfd-fyi-backend
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
restart: always
|
||||||
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
version: "3.9"
|
||||||
|
services:
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
context: .
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
links:
|
||||||
|
- "backend:backend"
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
context: backend
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
61
flake.lock
generated
61
flake.lock
generated
@@ -1,61 +0,0 @@
|
|||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
||||||
42
flake.nix
42
flake.nix
@@ -1,42 +0,0 @@
|
|||||||
{
|
|
||||||
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; [
|
|
||||||
nodejs_25
|
|
||||||
go
|
|
||||||
pkg-config
|
|
||||||
git
|
|
||||||
curl
|
|
||||||
jq
|
|
||||||
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'"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
78
index.html
78
index.html
@@ -1,78 +0,0 @@
|
|||||||
<!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, maximum-scale=1.0, user-scalable=no">
|
|
||||||
<meta name="description" content="An alternative frontend for hot 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</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 only
|
|
||||||
const savedTheme = localStorage.getItem('theme');
|
|
||||||
if (!savedTheme) {
|
|
||||||
return; // Let Vue handle default theme
|
|
||||||
}
|
|
||||||
|
|
||||||
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
||||||
let theme = savedTheme;
|
|
||||||
|
|
||||||
// Handle 'auto' theme preference
|
|
||||||
if (theme === 'auto') {
|
|
||||||
theme = prefersDark ? 'dark' : 'light';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply theme to html element
|
|
||||||
document.documentElement.setAttribute('data-bs-theme', theme);
|
|
||||||
document.documentElement.setAttribute('data-theme', theme);
|
|
||||||
|
|
||||||
// Apply theme classes
|
|
||||||
if (theme === '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');
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
</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>
|
|
||||||
8712
package-lock.json
generated
8712
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": "vite",
|
"serve": "vue-cli-service serve",
|
||||||
"preview": "vite preview",
|
"build": "vue-cli-service build",
|
||||||
"build": "vite build",
|
"lint": "vue-cli-service lint"
|
||||||
"lint": "eslint . --fix"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/roboto": "5.2.10",
|
|
||||||
"@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.12.0",
|
"axios": "^1.6.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",
|
||||||
"dayjs": "^1.11.10",
|
"jquery": "^3.7.0",
|
||||||
"vue": "^3.5.17",
|
"moment": "^2.29.4",
|
||||||
|
"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": "^5.0.0"
|
"vue-router": "4.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.22.10",
|
"@babel/core": "^7.22.10",
|
||||||
"@babel/eslint-parser": "^7.22.10",
|
"@babel/eslint-parser": "^7.22.10",
|
||||||
"@vitejs/plugin-vue": "^5.2.3",
|
"@types/bootstrap": "^5.2.6",
|
||||||
|
"@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.9",
|
"@vue/cli-service": "^5.0.8",
|
||||||
"eslint": "^8.47.0",
|
"eslint": "^9.0.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": "^7.0.0"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
@@ -48,5 +48,11 @@
|
|||||||
"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.2 KiB After Width: | Height: | Size: 5.1 KiB |
25
public/index.html
Normal file
25
public/index.html
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<!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>
|
||||||
718
src/App.vue
718
src/App.vue
@@ -1,585 +1,237 @@
|
|||||||
<script>
|
<script>
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import dayjs from "dayjs";
|
import moment from "moment";
|
||||||
import utc from "dayjs/plugin/utc";
|
import Loading from "vue-loading-overlay";
|
||||||
|
import GithubButton from "vue-github-button";
|
||||||
|
import { install } from "@github/hotkey";
|
||||||
|
|
||||||
import "./theme.css";
|
import "vue-loading-overlay/dist/css/index.css";
|
||||||
|
|
||||||
dayjs.extend(utc);
|
|
||||||
|
|
||||||
// Color palette for dealer labels - muted, visually distinct colors
|
|
||||||
const DEALER_COLORS = [
|
|
||||||
{ bg: '#e8eef4', border: '#5a7a9a', text: '#4a6a8a' }, // Muted Blue
|
|
||||||
{ bg: '#ece8f0', border: '#7a6a8a', text: '#6a5a7a' }, // Muted Purple
|
|
||||||
{ bg: '#e8f0e8', border: '#5a7a5a', text: '#4a6a4a' }, // Muted Green
|
|
||||||
{ bg: '#f0ebe5', border: '#9a7a5a', text: '#8a6a4a' }, // Muted Orange
|
|
||||||
{ bg: '#f0e8ec', border: '#8a5a6a', text: '#7a4a5a' }, // Muted Pink
|
|
||||||
{ bg: '#e5efed', border: '#5a7a75', text: '#4a6a65' }, // Muted Teal
|
|
||||||
{ bg: '#f0ede5', border: '#9a8a5a', text: '#8a7a4a' }, // Muted Amber
|
|
||||||
{ bg: '#eaf0e8', border: '#6a8a5a', text: '#5a7a4a' }, // Muted Light Green
|
|
||||||
{ bg: '#e8e9f0', border: '#5a5a8a', text: '#4a4a7a' }, // Muted Indigo
|
|
||||||
{ bg: '#ece9e6', border: '#6a5a50', text: '#5a4a40' }, // Muted Brown
|
|
||||||
{ bg: '#e5f0f0', border: '#5a8a8a', text: '#4a7a7a' }, // Muted Cyan
|
|
||||||
{ bg: '#f0e8e5', border: '#9a6a5a', text: '#8a5a4a' }, // Muted Deep Orange
|
|
||||||
];
|
|
||||||
|
|
||||||
// Dark theme color palette - muted colors
|
|
||||||
const DEALER_COLORS_DARK = [
|
|
||||||
{ bg: '#2a3a4a', border: '#7a9ab0', text: '#9ab0c0' }, // Muted Blue
|
|
||||||
{ bg: '#3a3040', border: '#9a8aaa', text: '#b0a0c0' }, // Muted Purple
|
|
||||||
{ bg: '#2a3a2a', border: '#7a9a7a', text: '#9ab09a' }, // Muted Green
|
|
||||||
{ bg: '#3a3025', border: '#a09070', text: '#b0a080' }, // Muted Orange
|
|
||||||
{ bg: '#3a2a30', border: '#a07a8a', text: '#b09aa0' }, // Muted Pink
|
|
||||||
{ bg: '#253a38', border: '#7a9a95', text: '#9ab0aa' }, // Muted Teal
|
|
||||||
{ bg: '#3a3525', border: '#a09a70', text: '#b0aa80' }, // Muted Amber
|
|
||||||
{ bg: '#2a3a25', border: '#8a9a7a', text: '#a0b090' }, // Muted Light Green
|
|
||||||
{ bg: '#30304a', border: '#8a8aaa', text: '#a0a0c0' }, // Muted Indigo
|
|
||||||
{ bg: '#352d28', border: '#8a7a70', text: '#a09a90' }, // Muted Brown
|
|
||||||
{ bg: '#253a3a', border: '#7a9a9a', text: '#9ab0b0' }, // Muted Cyan
|
|
||||||
{ bg: '#3a2a25', border: '#a08070', text: '#b09a8a' }, // Muted Deep Orange
|
|
||||||
];
|
|
||||||
|
|
||||||
// Simple hash function for consistent color assignment
|
|
||||||
function hashString(str) {
|
|
||||||
let hash = 0;
|
|
||||||
const normalizedStr = str.toLowerCase().trim();
|
|
||||||
for (let i = 0; i < normalizedStr.length; i++) {
|
|
||||||
const char = normalizedStr.charCodeAt(i);
|
|
||||||
hash = ((hash << 5) - hash) + char;
|
|
||||||
hash = hash & hash; // Convert to 32-bit integer
|
|
||||||
}
|
|
||||||
return Math.abs(hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
filterInput: "",
|
ascending: this.ascending,
|
||||||
activeFilters: this.parseFiltersFromUrl(),
|
filter: window.location.href.split("filter=")[1] || "",
|
||||||
sortMethod: "score",
|
|
||||||
viewMode: "cards",
|
|
||||||
topics: [],
|
|
||||||
isMobile: false,
|
|
||||||
currentTheme: "auto",
|
|
||||||
darkModeQuery: null,
|
|
||||||
themeChangeHandler: null,
|
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
menuOpen: false,
|
sortColumn: this.sortColumn,
|
||||||
infoOverlayVisible: false,
|
topics: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener("keydown", this.handleKeyDown);
|
// Install all the hotkeys on the page
|
||||||
window.addEventListener("resize", this.handleResize);
|
for (const el of document.querySelectorAll("[data-hotkey]")) {
|
||||||
window.addEventListener("click", this.handleClickOutside);
|
install(el);
|
||||||
this.detectMobile();
|
|
||||||
this.fetchDeals();
|
|
||||||
this.initializeSortMethod();
|
|
||||||
this.initializeViewMode();
|
|
||||||
this.initializeTheme();
|
|
||||||
this.setupThemeListener();
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeUnmount() {
|
|
||||||
window.removeEventListener("keydown", this.handleKeyDown);
|
|
||||||
window.removeEventListener("resize", this.handleResize);
|
|
||||||
window.removeEventListener("click", this.handleClickOutside);
|
|
||||||
if (this.darkModeQuery && this.themeChangeHandler) {
|
|
||||||
this.darkModeQuery.removeEventListener("change", this.themeChangeHandler);
|
|
||||||
}
|
}
|
||||||
|
this.sortColumn = localStorage.getItem("sortColumn") || "score";
|
||||||
|
this.ascending =
|
||||||
|
localStorage.getItem("ascending") === "false" ? false : true;
|
||||||
|
this.isLoading = true;
|
||||||
|
this.fetchDeals();
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
|
||||||
filteredTopics() {
|
|
||||||
const filterTerms = this.activeFilters.map(f => f.toLowerCase());
|
|
||||||
|
|
||||||
const filtered = this.topics.filter((row) => {
|
|
||||||
if (filterTerms.length === 0) return true;
|
|
||||||
const searchText = `${row.title} [${row.Offer.dealer_name}]`.toLowerCase();
|
|
||||||
return filterTerms.every(term => searchText.includes(term));
|
|
||||||
});
|
|
||||||
|
|
||||||
const sortFns = {
|
|
||||||
score: (a, b) => b.score - a.score,
|
|
||||||
views: (a, b) => b.total_views - a.total_views,
|
|
||||||
recency: (a, b) => new Date(b.last_post_time) - new Date(a.last_post_time),
|
|
||||||
};
|
|
||||||
|
|
||||||
return filtered.sort(sortFns[this.sortMethod] || sortFns.score);
|
|
||||||
},
|
|
||||||
|
|
||||||
themeIcon() {
|
|
||||||
const icons = { auto: "brightness_auto", dark: "dark_mode", light: "light_mode" };
|
|
||||||
return icons[this.currentTheme];
|
|
||||||
},
|
|
||||||
|
|
||||||
themeTitle() {
|
|
||||||
const titles = {
|
|
||||||
auto: "Theme: Auto (click for Light)",
|
|
||||||
light: "Theme: Light (click for Dark)",
|
|
||||||
dark: "Theme: Dark (click for Auto)",
|
|
||||||
};
|
|
||||||
return titles[this.currentTheme];
|
|
||||||
},
|
|
||||||
|
|
||||||
sortIcon() {
|
|
||||||
const icons = { score: "trending_up", views: "visibility", recency: "schedule" };
|
|
||||||
return icons[this.sortMethod];
|
|
||||||
},
|
|
||||||
|
|
||||||
sortTitle() {
|
|
||||||
const titles = {
|
|
||||||
score: "Sort by Score (click for Views)",
|
|
||||||
views: "Sort by Views (click for Recency)",
|
|
||||||
recency: "Sort by Recency (click for Score)",
|
|
||||||
};
|
|
||||||
return titles[this.sortMethod];
|
|
||||||
},
|
|
||||||
|
|
||||||
viewIcon() {
|
|
||||||
const icons = { cards: "grid_view", list: "view_list" };
|
|
||||||
return icons[this.viewMode];
|
|
||||||
},
|
|
||||||
|
|
||||||
viewTitle() {
|
|
||||||
const titles = {
|
|
||||||
cards: "View: Cards (click for List)",
|
|
||||||
list: "View: List (click for Cards)",
|
|
||||||
};
|
|
||||||
return titles[this.viewMode];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
formatDate(dateString) {
|
createFilterRoute(params) {
|
||||||
return dayjs(String(dateString)).format("YYYY-MM-DD hh:mm A");
|
this.$refs.filter.blur();
|
||||||
|
history.pushState(
|
||||||
|
{},
|
||||||
|
null,
|
||||||
|
`${window.location.origin}#/filter=${encodeURIComponent(params)}`
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
highlightText(text) {
|
|
||||||
if (!this.activeFilters || this.activeFilters.length === 0) return text;
|
|
||||||
|
|
||||||
let result = text;
|
|
||||||
for (const filter of this.activeFilters) {
|
|
||||||
const lowerText = result.toLowerCase();
|
|
||||||
const lowerFilter = filter.toLowerCase();
|
|
||||||
|
|
||||||
if (lowerText.includes(lowerFilter)) {
|
|
||||||
const regex = new RegExp(filter.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "ig");
|
|
||||||
result = result.replace(regex, (match) => `<mark>${match}</mark>`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
|
|
||||||
initializeTheme() {
|
|
||||||
const savedTheme = localStorage.getItem("theme") || "auto";
|
|
||||||
this.currentTheme = savedTheme;
|
|
||||||
this.applyTheme(savedTheme, true);
|
|
||||||
},
|
|
||||||
|
|
||||||
setupThemeListener() {
|
|
||||||
this.darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
||||||
|
|
||||||
this.themeChangeHandler = (e) => {
|
|
||||||
const savedTheme = localStorage.getItem("theme");
|
|
||||||
if (savedTheme === "auto" || !savedTheme) {
|
|
||||||
this.applyThemeActual(e.matches ? "dark" : "light");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.darkModeQuery.addEventListener("change", this.themeChangeHandler);
|
|
||||||
},
|
|
||||||
|
|
||||||
applyTheme(theme, skipSave = false) {
|
|
||||||
this.currentTheme = theme;
|
|
||||||
|
|
||||||
if (!skipSave) {
|
|
||||||
localStorage.setItem("theme", theme);
|
|
||||||
}
|
|
||||||
|
|
||||||
let actualTheme = theme;
|
|
||||||
if (theme === "auto") {
|
|
||||||
actualTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.applyThemeActual(actualTheme);
|
|
||||||
},
|
|
||||||
|
|
||||||
applyThemeActual(theme) {
|
|
||||||
document.documentElement.setAttribute("data-bs-theme", theme);
|
|
||||||
document.documentElement.classList.toggle("dark-theme", theme === "dark");
|
|
||||||
document.documentElement.classList.toggle("light-theme", theme === "light");
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleTheme() {
|
|
||||||
const cycle = { auto: "light", light: "dark", dark: "auto" };
|
|
||||||
this.applyTheme(cycle[this.currentTheme]);
|
|
||||||
},
|
|
||||||
|
|
||||||
detectMobile() {
|
|
||||||
const hasTouch =
|
|
||||||
"ontouchstart" in window ||
|
|
||||||
navigator.maxTouchPoints > 0 ||
|
|
||||||
navigator.msMaxTouchPoints > 0;
|
|
||||||
|
|
||||||
const isMobileScreen = window.innerWidth <= 1024;
|
|
||||||
this.isMobile = hasTouch || isMobileScreen;
|
|
||||||
},
|
|
||||||
|
|
||||||
handleResize() {
|
|
||||||
this.detectMobile();
|
|
||||||
},
|
|
||||||
|
|
||||||
handleKeyDown(event) {
|
|
||||||
const isInput = ["INPUT", "TEXTAREA"].includes(document.activeElement.tagName);
|
|
||||||
|
|
||||||
if (event.key === "/" && !isInput) {
|
|
||||||
event.preventDefault();
|
|
||||||
this.$refs.filterInput.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === "r" && !isInput) {
|
|
||||||
event.preventDefault();
|
|
||||||
this.fetchDeals();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === "i" && !isInput) {
|
|
||||||
event.preventDefault();
|
|
||||||
this.toggleInfoOverlay();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === "Escape" && this.infoOverlayVisible) {
|
|
||||||
event.preventDefault();
|
|
||||||
this.toggleInfoOverlay();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === "s" && !isInput) {
|
|
||||||
event.preventDefault();
|
|
||||||
this.toggleSort();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === "v" && !isInput) {
|
|
||||||
event.preventDefault();
|
|
||||||
this.toggleViewMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === "t" && !isInput) {
|
|
||||||
event.preventDefault();
|
|
||||||
this.toggleTheme();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
parseFiltersFromUrl() {
|
|
||||||
const hash = window.location.hash || "";
|
|
||||||
const match = hash.match(/filters=([^&]*)/);
|
|
||||||
if (match && match[1]) {
|
|
||||||
try {
|
|
||||||
const decoded = decodeURIComponent(match[1]);
|
|
||||||
return JSON.parse(decoded);
|
|
||||||
} catch (e) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Legacy single filter support
|
|
||||||
const legacyMatch = hash.match(/filter=([^&]*)/);
|
|
||||||
if (legacyMatch && legacyMatch[1]) {
|
|
||||||
const decoded = decodeURIComponent(legacyMatch[1]);
|
|
||||||
return decoded ? [decoded] : [];
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
},
|
|
||||||
|
|
||||||
updateUrlWithFilters() {
|
|
||||||
if (this.activeFilters.length > 0) {
|
|
||||||
const encoded = encodeURIComponent(JSON.stringify(this.activeFilters));
|
|
||||||
history.pushState({}, null, `${window.location.origin}#/filters=${encoded}`);
|
|
||||||
} else {
|
|
||||||
history.pushState({}, null, window.location.origin);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
applyFilter() {
|
|
||||||
const trimmed = this.filterInput.trim();
|
|
||||||
if (trimmed && !this.activeFilters.includes(trimmed)) {
|
|
||||||
this.activeFilters.push(trimmed);
|
|
||||||
this.filterInput = "";
|
|
||||||
this.$refs.filterInput.blur();
|
|
||||||
this.updateUrlWithFilters();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
clearFilter(index) {
|
|
||||||
this.activeFilters.splice(index, 1);
|
|
||||||
this.updateUrlWithFilters();
|
|
||||||
},
|
|
||||||
|
|
||||||
clearAllFilters() {
|
|
||||||
this.activeFilters = [];
|
|
||||||
this.filterInput = "";
|
|
||||||
this.updateUrlWithFilters();
|
|
||||||
},
|
|
||||||
|
|
||||||
fetchDeals() {
|
fetchDeals() {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
const minLoadingTime = new Promise(resolve => setTimeout(resolve, 500));
|
axios
|
||||||
|
.get("api/v1/topics")
|
||||||
Promise.all([
|
.then((response) => {
|
||||||
axios.get("api/v1/topics"),
|
|
||||||
minLoadingTime
|
|
||||||
])
|
|
||||||
.then(([response]) => {
|
|
||||||
this.topics = response.data;
|
this.topics = response.data;
|
||||||
|
this.isLoading = false;
|
||||||
|
this.sortTable(this.sortColumn, false);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error("Failed to fetch deals:", err.response || err);
|
console.log(err.response);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
this.isLoading = false;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
sortTable: function sortTable(col, flipAscending) {
|
||||||
|
if (this.sortColumn === col && flipAscending) {
|
||||||
|
this.ascending = !this.ascending;
|
||||||
|
}
|
||||||
|
|
||||||
initializeSortMethod() {
|
var ascending = this.ascending;
|
||||||
const saved = localStorage.getItem("sortMethod");
|
|
||||||
if (saved) {
|
localStorage.setItem("ascending", this.ascending);
|
||||||
this.sortMethod = saved;
|
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;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSort() {
|
|
||||||
const cycle = { score: "views", views: "recency", recency: "score" };
|
|
||||||
this.sortMethod = cycle[this.sortMethod];
|
|
||||||
localStorage.setItem("sortMethod", this.sortMethod);
|
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
initializeViewMode() {
|
formatDate() {
|
||||||
const saved = localStorage.getItem("viewMode");
|
return (v) => {
|
||||||
if (saved) {
|
return moment(String(v)).format("hh:mm A z (MM/DD)");
|
||||||
this.viewMode = saved;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleViewMode() {
|
|
||||||
const cycle = { cards: "list", list: "cards" };
|
|
||||||
this.viewMode = cycle[this.viewMode];
|
|
||||||
localStorage.setItem("viewMode", this.viewMode);
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleMenu() {
|
|
||||||
this.menuOpen = !this.menuOpen;
|
|
||||||
},
|
|
||||||
|
|
||||||
closeMenu() {
|
|
||||||
this.menuOpen = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
handleMenuAction(action) {
|
|
||||||
action();
|
|
||||||
this.closeMenu();
|
|
||||||
},
|
|
||||||
|
|
||||||
handleClickOutside(event) {
|
|
||||||
if (this.menuOpen && !event.target.closest('.mobile-menu-wrapper')) {
|
|
||||||
this.closeMenu();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
getDealerColor(dealerName) {
|
|
||||||
if (!dealerName) return null;
|
|
||||||
const isDark = document.documentElement.getAttribute('data-bs-theme') === 'dark' ||
|
|
||||||
document.documentElement.classList.contains('dark-theme') ||
|
|
||||||
(this.currentTheme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
||||||
const colors = isDark ? DEALER_COLORS_DARK : DEALER_COLORS;
|
|
||||||
const index = hashString(dealerName) % colors.length;
|
|
||||||
return colors[index];
|
|
||||||
},
|
|
||||||
|
|
||||||
getDealerStyle(dealerName) {
|
|
||||||
const color = this.getDealerColor(dealerName);
|
|
||||||
if (!color) return {};
|
|
||||||
return {
|
|
||||||
backgroundColor: color.bg,
|
|
||||||
borderColor: color.border,
|
|
||||||
color: color.text,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
toggleInfoOverlay() {
|
columns() {
|
||||||
this.infoOverlayVisible = !this.infoOverlayVisible;
|
return {
|
||||||
|
Deal: "deal",
|
||||||
|
Score: "score",
|
||||||
|
Views: "total_views",
|
||||||
|
"Last Reply": "last_post_time",
|
||||||
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
filteredTopics() {
|
||||||
toggleInfoOverlay() {
|
return this.topics.filter((row) => {
|
||||||
this.infoOverlayVisible = !this.infoOverlayVisible;
|
const titles = (
|
||||||
|
row.title.toString() +
|
||||||
|
" [" +
|
||||||
|
row.Offer.dealer_name +
|
||||||
|
"]"
|
||||||
|
).toLowerCase();
|
||||||
|
const filterTerm = this.filter.toLowerCase();
|
||||||
|
return titles.includes(filterTerm);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
highlightMatches() {
|
||||||
|
return (v) => {
|
||||||
|
if (this.filter == "") return v;
|
||||||
|
const matchExists = v.toLowerCase().includes(this.filter.toLowerCase());
|
||||||
|
if (!matchExists) return v;
|
||||||
|
|
||||||
|
const re = new RegExp(this.filter, "ig");
|
||||||
|
return v.replace(re, (matchedText) => `<mark>${matchedText}</mark>`);
|
||||||
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
Loading,
|
||||||
|
GithubButton,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
|
||||||
<div class="container">
|
<body>
|
||||||
<div class="header">
|
|
||||||
<div class="header-controls">
|
|
||||||
<div class="filter-container" :class="{ 'has-active-filters': activeFilters.length > 0 }">
|
|
||||||
<span v-for="(filter, index) in activeFilters" :key="index" class="filter-tag">
|
|
||||||
{{ filter }}
|
|
||||||
<button class="filter-tag-clear" @click="clearFilter(index)" title="Clear filter">
|
|
||||||
<span class="material-symbols-outlined">close</span>
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
<input
|
<input
|
||||||
ref="filterInput"
|
class="form-control"
|
||||||
v-model="filterInput"
|
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Filter deals"
|
id="filter"
|
||||||
class="search-input"
|
placeholder="Filter"
|
||||||
@keyup.enter="applyFilter"
|
|
||||||
@keyup.esc="$refs.filterInput.blur()"
|
data-hotkey="/"
|
||||||
|
v-model="filter"
|
||||||
|
v-on:keyup.enter="createFilterRoute(this.filter.toString())"
|
||||||
|
v-on:keyup.escape="this.$refs.filter.blur()"
|
||||||
|
ref="filter"
|
||||||
/>
|
/>
|
||||||
</div>
|
<table class="table table-hover">
|
||||||
<!-- Desktop buttons -->
|
<thead class="thead text-muted">
|
||||||
<button class="icon-button desktop-only" title="Refresh deals" @click="fetchDeals" :disabled="isLoading">
|
<tr>
|
||||||
<span class="material-symbols-outlined" :class="{ 'spinning': isLoading }">refresh</span>
|
<th
|
||||||
</button>
|
v-for="(col, key) in columns"
|
||||||
<button class="icon-button desktop-only" :title="sortTitle" @click="toggleSort">
|
v-on:click="sortTable(col, true)"
|
||||||
<span class="material-symbols-outlined">{{ sortIcon }}</span>
|
:key="col"
|
||||||
</button>
|
>
|
||||||
<button class="icon-button desktop-only" :title="viewTitle" @click="toggleViewMode">
|
{{ key }}
|
||||||
<span class="material-symbols-outlined">{{ viewIcon }}</span>
|
<div
|
||||||
</button>
|
class="arrow"
|
||||||
<button class="icon-button desktop-only" :title="themeTitle" @click="toggleTheme">
|
v-if="col == sortColumn"
|
||||||
<span class="material-symbols-outlined">{{ themeIcon }}</span>
|
v-bind:class="ascending ? 'arrow_up' : 'arrow_down'"
|
||||||
</button>
|
></div>
|
||||||
<button class="icon-button desktop-only" title="Info" @click="toggleInfoOverlay">
|
</th>
|
||||||
<span class="material-symbols-outlined">info</span>
|
</tr>
|
||||||
</button>
|
</thead>
|
||||||
<div class="mobile-menu-wrapper mobile-only">
|
<tbody>
|
||||||
<button class="icon-button" title="Menu" @click="toggleMenu">
|
<loading
|
||||||
<span class="material-symbols-outlined">{{ menuOpen ? 'close' : 'menu' }}</span>
|
v-model:active="isLoading"
|
||||||
</button>
|
color="#ccc"
|
||||||
<div class="mobile-dropdown" v-if="menuOpen" @click.stop>
|
opacity="0"
|
||||||
<button class="dropdown-item" @click="handleMenuAction(fetchDeals)" :disabled="isLoading">
|
loader="bars"
|
||||||
<span class="material-symbols-outlined" :class="{ 'spinning': isLoading }">refresh</span>
|
:is-full-page="false"
|
||||||
<span>Refresh</span>
|
>
|
||||||
</button>
|
</loading>
|
||||||
<button class="dropdown-item" @click="handleMenuAction(toggleSort)">
|
<tr
|
||||||
<span class="material-symbols-outlined">{{ sortIcon }}</span>
|
scope="row"
|
||||||
<span>{{ sortTitle.split('(')[0].trim() }}</span>
|
v-for="(topic, index) in filteredTopics"
|
||||||
</button>
|
:key="`topic.topic_id-${index}`"
|
||||||
<button class="dropdown-item" @click="handleMenuAction(toggleViewMode)">
|
>
|
||||||
<span class="material-symbols-outlined">{{ viewIcon }}</span>
|
<td scope="col">
|
||||||
<span>{{ viewTitle.split('(')[0].trim() }}</span>
|
|
||||||
</button>
|
|
||||||
<button class="dropdown-item" @click="toggleInfoOverlay">
|
|
||||||
<span class="material-symbols-outlined">info</span>
|
|
||||||
<span>Info</span>
|
|
||||||
</button>
|
|
||||||
<button class="dropdown-item" @click="handleMenuAction(toggleTheme)">
|
|
||||||
<span class="material-symbols-outlined">{{ themeIcon }}</span>
|
|
||||||
<span>{{ themeTitle.split('(')[0].trim() }}</span>
|
|
||||||
</button>
|
|
||||||
<button class="dropdown-item" @click="toggleInfoOverlay">
|
|
||||||
<span class="material-symbols-outlined">info</span>
|
|
||||||
<span>Info</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<InfoOverlay :visible="infoOverlayVisible" @close="toggleInfoOverlay" />
|
|
||||||
<div v-if="isLoading && topics.length === 0" class="loading-container">
|
|
||||||
<span class="material-symbols-outlined spinning loading-spinner">refresh</span>
|
|
||||||
<p>Loading deals...</p>
|
|
||||||
</div>
|
|
||||||
<div class="cards-wrapper" v-else>
|
|
||||||
<div v-if="isLoading" class="loading-overlay">
|
|
||||||
<span class="material-symbols-outlined spinning loading-spinner">refresh</span>
|
|
||||||
</div>
|
|
||||||
<div :class="viewMode === 'cards' ? 'cards-grid' : 'list-view'">
|
|
||||||
<div v-for="topic in filteredTopics" :key="topic.topic_id" :class="viewMode === 'cards' ? 'deal-card' : 'deal-row'">
|
|
||||||
<div class="card-header">
|
|
||||||
<div class="title-with-link">
|
|
||||||
<a
|
<a
|
||||||
:href="`https://forums.redflagdeals.com${topic.web_path}`"
|
:href="`https://forums.redflagdeals.com${topic.web_path}`"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="deal-title"
|
v-html="
|
||||||
v-html="highlightText(topic.title)"
|
highlightMatches(
|
||||||
|
topic.title + ' [' + topic.Offer.dealer_name + '] '
|
||||||
|
)
|
||||||
|
"
|
||||||
></a>
|
></a>
|
||||||
<a
|
<a
|
||||||
v-if="topic.Offer.url"
|
:href="`${topic.Offer.url}`"
|
||||||
:href="topic.Offer.url"
|
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="card-link"
|
v-if="topic.Offer.url"
|
||||||
title="Open direct link to deal"
|
><span class="material-symbols-outlined"> link </span></a
|
||||||
>
|
>
|
||||||
<span class="material-symbols-outlined">open_in_new</span>
|
<span v-if="!topic.Offer.url" class="material-symbols-outlined">
|
||||||
</a>
|
link_off
|
||||||
</div>
|
</span>
|
||||||
<div
|
</td>
|
||||||
class="score-bubble"
|
<td v-if="topic.score > 0" scope="col" class="green-score">
|
||||||
:class="{
|
+{{ topic.score }}
|
||||||
positive: topic.score > 0,
|
</td>
|
||||||
negative: topic.score < 0,
|
<td v-if="topic.score < 0" scope="col" class="red-score">
|
||||||
neutral: topic.score === 0,
|
{{ 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 v-if="topic.score > 0">+{{ topic.score }}</span>
|
|
||||||
<span v-else>{{ topic.score }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-meta" v-if="topic.Offer.dealer_name">
|
</body>
|
||||||
<span
|
</template>
|
||||||
class="dealer-name dealer-label"
|
|
||||||
:style="getDealerStyle(topic.Offer.dealer_name)"
|
|
||||||
v-html="highlightText(topic.Offer.dealer_name)"
|
|
||||||
></span>
|
|
||||||
</div>
|
|
||||||
<div class="card-details" v-if="viewMode === 'cards'">
|
|
||||||
<div class="details-stats">
|
|
||||||
<div class="stat">
|
|
||||||
<span class="material-symbols-outlined">visibility</span>
|
|
||||||
<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">First post: {{ formatDate(topic.post_time) }}</div>
|
|
||||||
<div class="card-timestamp">Last post: {{ formatDate(topic.last_post_time) }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="row-stats" v-if="viewMode === 'list'">
|
|
||||||
<span class="stat-compact">{{ formatDate(topic.post_time) }} - {{ formatDate(topic.last_post_time) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<InfoOverlay :visible="infoOverlayVisible" @close="toggleInfoOverlay" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
<style>
|
||||||
.cards-wrapper {
|
#app {
|
||||||
position: relative;
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||||
}
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
.loading-overlay {
|
text-align: center;
|
||||||
position: absolute;
|
color: #2c3e50;
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background-color: rgba(128, 128, 128, 0.3);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 10;
|
|
||||||
border-radius: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-overlay .loading-spinner {
|
|
||||||
font-size: 48px;
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="info-overlay" v-if="visible" @click.self="closeOverlay">
|
|
||||||
<div class="info-panel">
|
|
||||||
<strong>Source: </strong>
|
|
||||||
<a href="https://github.com/davegallant/rfd-fyi" target="_blank" rel="noopener noreferrer">
|
|
||||||
https://github.com/davegallant/rfd-fyi
|
|
||||||
</a>
|
|
||||||
<h3>Keyboard Shortcuts</h3>
|
|
||||||
<table class="shortcuts-table">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td><strong>r</strong></td>
|
|
||||||
<td>Refresh deals</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>s</strong></td>
|
|
||||||
<td>Toggle sort</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>v</strong></td>
|
|
||||||
<td>Toggle view mode</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>t</strong></td>
|
|
||||||
<td>Toggle theme</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>/</strong></td>
|
|
||||||
<td>Filter deals</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<button class="close-button" @click="closeOverlay">Close</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: "InfoOverlay",
|
|
||||||
props: {
|
|
||||||
visible: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
closeOverlay() {
|
|
||||||
this.$emit("close");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.info-overlay {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-panel {
|
|
||||||
background: var(--bg-primary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 20px;
|
|
||||||
max-width: 400px;
|
|
||||||
width: 90%;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-panel h2 {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-panel .shortcuts-table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin: 16px auto;
|
|
||||||
text-align: left;
|
|
||||||
padding-left: 40px;
|
|
||||||
display: table;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-panel .shortcuts-table td {
|
|
||||||
padding: 8px;
|
|
||||||
text-align: left;
|
|
||||||
vertical-align: middle;
|
|
||||||
padding-left: 40px;
|
|
||||||
padding-right: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.close-button {
|
|
||||||
margin-top: 20px;
|
|
||||||
padding: 10px 20px;
|
|
||||||
background-color: #007bff;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.close-button:hover {
|
|
||||||
background-color: #0056b3;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
17
src/main.js
17
src/main.js
@@ -1,20 +1,23 @@
|
|||||||
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";
|
||||||
|
|
||||||
const routes = [
|
import "bootstrap/dist/css/bootstrap.min.css";
|
||||||
{
|
import "bootstrap/dist/js/bootstrap.min.js";
|
||||||
path: '/:pathMatch(.*)*',
|
|
||||||
component: App,
|
import "./theme.css";
|
||||||
},
|
|
||||||
];
|
const routes = [];
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHashHistory(),
|
history: createWebHashHistory(),
|
||||||
routes,
|
routes,
|
||||||
});
|
});
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App).use(VueGtag, {
|
||||||
|
config: { id: "G-YF11ZH9SYD" },
|
||||||
|
});
|
||||||
|
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
740
src/theme.css
740
src/theme.css
@@ -1,734 +1,68 @@
|
|||||||
/* Material Symbols Icon Font */
|
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 Variables
|
position: sticky;
|
||||||
============================================ */
|
top: 0;
|
||||||
|
|
||||||
:root {
|
|
||||||
/* Light theme (default) */
|
|
||||||
--bg-primary: #dddddd;
|
|
||||||
--bg-secondary: #e8e8e8;
|
|
||||||
--bg-input: #f5f5f5;
|
|
||||||
--bg-input-focus: #ffffff;
|
|
||||||
--text-primary: #212529;
|
|
||||||
--text-secondary: #6c757d;
|
|
||||||
--border-color: #d0d0d0;
|
|
||||||
--border-color-light: #cccccc;
|
|
||||||
--border-color-hover: #999999;
|
|
||||||
--link-color: #212529;
|
|
||||||
--score-positive-bg: rgb(90, 140, 90);
|
|
||||||
--score-positive-text: white;
|
|
||||||
--score-negative-bg: rgb(140, 50, 50);
|
|
||||||
--score-negative-text: white;
|
|
||||||
--mark-bg: rgba(255, 193, 7, 0.3);
|
|
||||||
--shadow-light: rgba(0, 0, 0, 0.05);
|
|
||||||
--shadow-medium: rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dark theme via media query */
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root:not([data-bs-theme="light"]):not(.light-theme) {
|
|
||||||
--bg-primary: #1a1a1a;
|
|
||||||
--bg-secondary: #2a2a2a;
|
|
||||||
--bg-input: #1a1a1a;
|
|
||||||
--bg-input-focus: #2a2a2a;
|
|
||||||
--text-primary: #e0e0e0;
|
|
||||||
--text-secondary: #a0a0a0;
|
|
||||||
--border-color: #3a3a3a;
|
|
||||||
--border-color-light: #555555;
|
|
||||||
--border-color-hover: #777777;
|
|
||||||
--link-color: #e0e0e0;
|
|
||||||
--score-positive-bg: rgb(100, 140, 80);
|
|
||||||
--score-positive-text: white;
|
|
||||||
--score-negative-bg: rgb(120, 45, 45);
|
|
||||||
--score-negative-text: white;
|
|
||||||
--mark-bg: rgba(255, 193, 7, 0.4);
|
|
||||||
--shadow-light: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Explicit dark theme */
|
|
||||||
html[data-bs-theme="dark"],
|
|
||||||
html.dark-theme {
|
|
||||||
--bg-primary: #1a1a1a;
|
|
||||||
--bg-secondary: #2a2a2a;
|
|
||||||
--bg-input: #1a1a1a;
|
|
||||||
--bg-input-focus: #2a2a2a;
|
|
||||||
--text-primary: #e0e0e0;
|
|
||||||
--text-secondary: #a0a0a0;
|
|
||||||
--border-color: #3a3a3a;
|
|
||||||
--border-color-light: #555555;
|
|
||||||
--border-color-hover: #777777;
|
|
||||||
--link-color: #e0e0e0;
|
|
||||||
--score-positive-bg: rgb(100, 140, 80);
|
|
||||||
--score-positive-text: white;
|
|
||||||
--score-negative-bg: rgb(120, 45, 45);
|
|
||||||
--score-negative-text: white;
|
|
||||||
--mark-bg: rgba(255, 193, 7, 0.4);
|
|
||||||
--shadow-light: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Explicit light theme */
|
|
||||||
html[data-bs-theme="light"],
|
|
||||||
html.light-theme {
|
|
||||||
--bg-primary: #dddddd;
|
|
||||||
--bg-secondary: #e8e8e8;
|
|
||||||
--bg-input: #f5f5f5;
|
|
||||||
--bg-input-focus: #ffffff;
|
|
||||||
--text-primary: #212529;
|
|
||||||
--text-secondary: #6c757d;
|
|
||||||
--border-color: #d0d0d0;
|
|
||||||
--border-color-light: #cccccc;
|
|
||||||
--border-color-hover: #999999;
|
|
||||||
--link-color: #212529;
|
|
||||||
--score-positive-bg: rgb(34, 139, 34);
|
|
||||||
--score-positive-text: white;
|
|
||||||
--mark-bg: rgba(255, 193, 7, 0.3);
|
|
||||||
--shadow-light: rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
Base Styles
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
font-family: sans-serif;
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
max-width: 100%;
|
|
||||||
background-color: var(--bg-primary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
transition: background-color 0.3s ease, color 0.3s ease;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: var(--link-color);
|
color: #96ada5; /**/
|
||||||
transition: color 0.2s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a:visited {
|
a:visited {
|
||||||
color: var(--link-color);
|
color: #53514f; /**/
|
||||||
}
|
}
|
||||||
|
a:hover {
|
||||||
/* ============================================
|
color: #d65d03; /**/
|
||||||
Layout
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.header-controls {
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
Responsive Visibility
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.desktop-only {
|
|
||||||
display: inline-flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-only {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.desktop-only {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-only {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
Mobile Menu
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.mobile-menu-wrapper {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-dropdown {
|
|
||||||
position: absolute;
|
|
||||||
top: calc(100% + 8px);
|
|
||||||
right: 0;
|
|
||||||
background-color: var(--bg-secondary);
|
|
||||||
border: 1px solid var(--border-color-light);
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 4px 12px var(--shadow-medium);
|
|
||||||
min-width: 180px;
|
|
||||||
z-index: 100;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
width: 100%;
|
|
||||||
padding: 12px 14px;
|
|
||||||
border: none;
|
|
||||||
background: transparent;
|
|
||||||
color: var(--text-primary);
|
|
||||||
font-size: 14px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.2s ease;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-item:hover {
|
|
||||||
background-color: var(--bg-input);
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-item:active {
|
|
||||||
background-color: var(--border-color-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-item:disabled {
|
|
||||||
opacity: 0.6;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-item .material-symbols-outlined {
|
|
||||||
font-size: 20px;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
Search Input
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.search-input {
|
|
||||||
flex: 1;
|
|
||||||
max-width: 500px;
|
|
||||||
padding: 10px 12px;
|
|
||||||
font-size: 14px;
|
|
||||||
border: 1px solid var(--border-color-light);
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: var(--bg-input);
|
|
||||||
color: var(--text-primary);
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
font-family: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-input:focus {
|
|
||||||
outline: none;
|
|
||||||
border-color: var(--border-color-hover);
|
|
||||||
background-color: var(--bg-input-focus);
|
|
||||||
box-shadow: 0 0 0 2px var(--shadow-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-input::placeholder {
|
|
||||||
color: var(--text-secondary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ============================================
|
footer {
|
||||||
Filter Container & Tags
|
background: #212529;
|
||||||
============================================ */
|
color: white;
|
||||||
|
padding: 3px;
|
||||||
.filter-container {
|
padding-right: 10px;
|
||||||
flex: 1;
|
padding-left: 10px;
|
||||||
max-width: 500px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
padding: 6px 10px;
|
|
||||||
border: 1px solid var(--border-color-light);
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: var(--bg-input);
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-container:focus-within {
|
|
||||||
border-color: var(--border-color-hover);
|
|
||||||
background-color: var(--bg-input-focus);
|
|
||||||
box-shadow: 0 0 0 2px var(--shadow-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-container .search-input {
|
|
||||||
flex: 1;
|
|
||||||
border: none;
|
|
||||||
padding: 4px 0;
|
|
||||||
background: transparent;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-container .search-input:focus {
|
|
||||||
outline: none;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-tag {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
padding: 4px 8px 4px 10px;
|
|
||||||
background-color: var(--border-color-light);
|
|
||||||
border-radius: 4px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--text-primary);
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-tag-clear {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 14px;
|
|
||||||
height: 14px;
|
|
||||||
padding: 0;
|
|
||||||
border: none;
|
|
||||||
background-color: var(--text-secondary);
|
|
||||||
border-radius: 50%;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
color: var(--bg-input);
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-tag-clear:hover {
|
|
||||||
background-color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-tag-clear .material-symbols-outlined {
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
Icon Buttons (Theme & Sort Toggle)
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.icon-button {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border: 1px solid var(--border-color-light);
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: var(--bg-input);
|
|
||||||
color: var(--text-primary);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
font-size: 18px;
|
|
||||||
padding: 0;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-button:hover {
|
|
||||||
background-color: var(--bg-secondary);
|
|
||||||
border-color: var(--border-color-hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-button:active {
|
|
||||||
transform: scale(0.95);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Legacy class names for compatibility */
|
|
||||||
.sort-toggle,
|
|
||||||
.theme-toggle {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border: 1px solid var(--border-color-light);
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: var(--bg-input);
|
|
||||||
color: var(--text-primary);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
font-size: 18px;
|
|
||||||
padding: 0;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sort-toggle:hover,
|
.footer-left {
|
||||||
.theme-toggle:hover {
|
float: left;
|
||||||
background-color: var(--bg-secondary);
|
|
||||||
border-color: var(--border-color-hover);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sort-toggle:active,
|
.footer-right {
|
||||||
.theme-toggle:active {
|
float: right;
|
||||||
transform: scale(0.95);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ============================================
|
.green-score {
|
||||||
Cards Grid
|
color: rgb(22, 120, 63) !important;
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.cards-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
|
||||||
gap: 20px;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ============================================
|
.red-score {
|
||||||
List View
|
color: rgb(175, 21, 21) !important;
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.list-view {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 8px;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.deal-row {
|
.arrow_down {
|
||||||
background-color: var(--bg-secondary);
|
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");
|
||||||
border: 1px solid var(--border-color-light);
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 10px 14px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
}
|
||||||
|
.arrow_up {
|
||||||
.deal-row .card-header {
|
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=");
|
||||||
display: contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deal-row:hover {
|
|
||||||
background-color: var(--bg-input);
|
|
||||||
border-color: var(--border-color-hover);
|
|
||||||
}
|
}
|
||||||
|
.arrow {
|
||||||
.deal-row .card-meta {
|
float: right;
|
||||||
margin-bottom: 0;
|
width: 10px;
|
||||||
flex-shrink: 0;
|
height: 12px;
|
||||||
order: 2;
|
background-repeat: no-repeat;
|
||||||
}
|
background-size: contain;
|
||||||
|
background-position-y: bottom;
|
||||||
.deal-row .title-with-link {
|
|
||||||
flex: 1;
|
|
||||||
order: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deal-row .deal-title {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deal-row .row-stats {
|
|
||||||
order: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deal-row .score-bubble {
|
|
||||||
min-width: 36px;
|
|
||||||
height: 24px;
|
|
||||||
font-size: 10px;
|
|
||||||
order: 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row-stats {
|
|
||||||
display: flex;
|
|
||||||
gap: 12px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-compact {
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.deal-row {
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row-stats {
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 8px;
|
|
||||||
padding-top: 8px;
|
|
||||||
border-top: 1px solid var(--border-color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.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 {
|
|
||||||
box-shadow: 0 4px 8px var(--shadow-medium);
|
|
||||||
border-color: var(--border-color-hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
Card Header
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.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-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
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.score-bubble {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-width: 40px;
|
|
||||||
height: 28px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 11px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
padding: 0 2px;
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.score-bubble.positive {
|
|
||||||
background-color: var(--score-positive-bg);
|
|
||||||
color: var(--score-positive-text);
|
|
||||||
box-shadow: 0 1px 3px rgba(34, 139, 34, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.score-bubble.negative {
|
|
||||||
background-color: var(--score-negative-bg);
|
|
||||||
color: var(--score-negative-text);
|
|
||||||
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 Meta & Details
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
.card-meta {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 6px;
|
|
||||||
font-size: 13px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dealer-name {
|
|
||||||
display: inline-block;
|
|
||||||
width: fit-content;
|
|
||||||
max-width: 100%;
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 9px;
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
border: 2px solid currentColor;
|
|
||||||
background-color: transparent;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
letter-spacing: 0.3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-timestamp {
|
|
||||||
color: var(--text-secondary);
|
|
||||||
font-size: 12px;
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
Mark Highlighting
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
mark {
|
|
||||||
background-color: var(--mark-bg);
|
|
||||||
color: inherit;
|
|
||||||
font-weight: 600;
|
|
||||||
border-radius: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
Mobile Responsive
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.cards-grid {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
padding: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-input {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================
|
|
||||||
Loading & Spinner
|
|
||||||
============================================ */
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
from {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinning {
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 60px 20px;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-container p {
|
|
||||||
margin-top: 16px;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-spinner {
|
|
||||||
font-size: 48px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-button:disabled {
|
|
||||||
opacity: 0.6;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-button:disabled:hover {
|
.material-symbols-outlined {
|
||||||
background-color: var(--bg-input);
|
font-size: medium;
|
||||||
border-color: var(--border-color-light);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
// 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,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
7
vue.config.js
Normal file
7
vue.config.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
const { defineConfig } = require("@vue/cli-service");
|
||||||
|
module.exports = defineConfig({
|
||||||
|
transpileDependencies: true,
|
||||||
|
devServer: {
|
||||||
|
proxy: "http://localhost:8080",
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user