mirror of
https://github.com/davegallant/rfd-fyi.git
synced 2026-03-03 17:46:35 +00:00
Compare commits
1 Commits
main
...
1bc17519ba
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bc17519ba |
@@ -1,4 +1 @@
|
|||||||
node_modules
|
backend
|
||||||
dist
|
|
||||||
.git
|
|
||||||
.github
|
|
||||||
|
|||||||
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@v6
|
||||||
|
|
||||||
|
- 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@v6
|
||||||
|
|
||||||
|
- 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 }}
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
|||||||
node_modules
|
node_modules
|
||||||
/dist
|
dist
|
||||||
data/
|
data/
|
||||||
backend/bin/
|
backend/bin/
|
||||||
.vscode
|
.vscode
|
||||||
|
|||||||
8
Caddyfile
Normal file
8
Caddyfile
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
auto_https off
|
||||||
|
}
|
||||||
|
|
||||||
|
:80 {
|
||||||
|
file_server
|
||||||
|
reverse_proxy /api/* rfd-fyi-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.10.2-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"]
|
|
||||||
|
|||||||
19
Makefile
19
Makefile
@@ -15,7 +15,7 @@ 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 && CGO_ENABLED=0 go run .
|
||||||
.PHONY: backend
|
.PHONY: backend
|
||||||
|
|
||||||
## frontend: Build and run the frontend from source
|
## frontend: Build and run the frontend from source
|
||||||
@@ -23,21 +23,20 @@ frontend:
|
|||||||
@npm run serve
|
@npm run 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
|
||||||
|
|||||||
32
README.md
32
README.md
@@ -4,30 +4,30 @@ This repository provides a simple, less-distracting overlay for hot deals posted
|
|||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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.21
|
||||||
|
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" ]
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
|
||||||
"math/rand/v2"
|
"math/rand/v2"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -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,22 @@ 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")
|
a.Router.HandleFunc("/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) {
|
||||||
|
|||||||
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>
|
|
||||||
@@ -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})
|
||||||
|
|
||||||
|
|||||||
16
docker-compose.prod.yml
Normal file
16
docker-compose.prod.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
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
|
||||||
18
docker-compose.yml
Normal file
18
docker-compose.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
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
|
||||||
11
flake.nix
11
flake.nix
@@ -14,12 +14,21 @@
|
|||||||
{
|
{
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
nodejs_25
|
# Node.js LTS with npm
|
||||||
|
nodejs_20
|
||||||
|
|
||||||
|
# Go for backend
|
||||||
go
|
go
|
||||||
|
|
||||||
|
# Build tools
|
||||||
pkg-config
|
pkg-config
|
||||||
|
|
||||||
|
# Development utilities
|
||||||
git
|
git
|
||||||
curl
|
curl
|
||||||
jq
|
jq
|
||||||
|
|
||||||
|
# Optional: for better development experience
|
||||||
gnumake
|
gnumake
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
675
package-lock.json
generated
675
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@
|
|||||||
"lint": "eslint . --fix"
|
"lint": "eslint . --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/roboto": "5.2.10",
|
"@fontsource/roboto": "5.2.9",
|
||||||
"@github/hotkey": "^3.0.0",
|
"@github/hotkey": "^3.0.0",
|
||||||
"@mdi/font": "7.4.47",
|
"@mdi/font": "7.4.47",
|
||||||
"@popperjs/core": "^2.11.8",
|
"@popperjs/core": "^2.11.8",
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
"postcss-cli": "^11.0.0",
|
"postcss-cli": "^11.0.0",
|
||||||
"sass-embedded": "^1.89.2",
|
"sass-embedded": "^1.89.2",
|
||||||
"unplugin-vue-components": "^31.0.0",
|
"unplugin-vue-components": "^31.0.0",
|
||||||
"vite": "^6.3.6"
|
"vite": "^7.0.0"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|||||||
57
src/App.vue
57
src/App.vue
@@ -65,7 +65,6 @@ export default {
|
|||||||
themeChangeHandler: null,
|
themeChangeHandler: null,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
menuOpen: false,
|
menuOpen: false,
|
||||||
infoOverlayVisible: false,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -243,31 +242,6 @@ export default {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.fetchDeals();
|
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() {
|
parseFiltersFromUrl() {
|
||||||
@@ -403,14 +377,6 @@ export default {
|
|||||||
color: color.text,
|
color: color.text,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
toggleInfoOverlay() {
|
|
||||||
this.infoOverlayVisible = !this.infoOverlayVisible;
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
toggleInfoOverlay() {
|
|
||||||
this.infoOverlayVisible = !this.infoOverlayVisible;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -450,9 +416,8 @@ export default {
|
|||||||
<button class="icon-button desktop-only" :title="themeTitle" @click="toggleTheme">
|
<button class="icon-button desktop-only" :title="themeTitle" @click="toggleTheme">
|
||||||
<span class="material-symbols-outlined">{{ themeIcon }}</span>
|
<span class="material-symbols-outlined">{{ themeIcon }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="icon-button desktop-only" title="Info" @click="toggleInfoOverlay">
|
|
||||||
<span class="material-symbols-outlined">info</span>
|
<!-- Mobile hamburger menu -->
|
||||||
</button>
|
|
||||||
<div class="mobile-menu-wrapper mobile-only">
|
<div class="mobile-menu-wrapper mobile-only">
|
||||||
<button class="icon-button" title="Menu" @click="toggleMenu">
|
<button class="icon-button" title="Menu" @click="toggleMenu">
|
||||||
<span class="material-symbols-outlined">{{ menuOpen ? 'close' : 'menu' }}</span>
|
<span class="material-symbols-outlined">{{ menuOpen ? 'close' : 'menu' }}</span>
|
||||||
@@ -470,27 +435,20 @@ export default {
|
|||||||
<span class="material-symbols-outlined">{{ viewIcon }}</span>
|
<span class="material-symbols-outlined">{{ viewIcon }}</span>
|
||||||
<span>{{ viewTitle.split('(')[0].trim() }}</span>
|
<span>{{ viewTitle.split('(')[0].trim() }}</span>
|
||||||
</button>
|
</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)">
|
<button class="dropdown-item" @click="handleMenuAction(toggleTheme)">
|
||||||
<span class="material-symbols-outlined">{{ themeIcon }}</span>
|
<span class="material-symbols-outlined">{{ themeIcon }}</span>
|
||||||
<span>{{ themeTitle.split('(')[0].trim() }}</span>
|
<span>{{ themeTitle.split('(')[0].trim() }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="dropdown-item" @click="toggleInfoOverlay">
|
|
||||||
<span class="material-symbols-outlined">info</span>
|
|
||||||
<span>Info</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<InfoOverlay :visible="infoOverlayVisible" @close="toggleInfoOverlay" />
|
|
||||||
<div v-if="isLoading && topics.length === 0" class="loading-container">
|
<div v-if="isLoading && topics.length === 0" class="loading-container">
|
||||||
<span class="material-symbols-outlined spinning loading-spinner">refresh</span>
|
<span class="material-symbols-outlined spinning loading-spinner">refresh</span>
|
||||||
<p>Loading deals...</p>
|
<p>Loading deals...</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="cards-wrapper" v-else>
|
<div class="cards-wrapper" v-else>
|
||||||
<div v-if="isLoading" class="loading-overlay">
|
<div v-if="isLoading" class="loading-overlay">
|
||||||
<span class="material-symbols-outlined spinning loading-spinner">refresh</span>
|
<span class="material-symbols-outlined spinning loading-spinner">refresh</span>
|
||||||
@@ -527,6 +485,7 @@ export default {
|
|||||||
<span v-else>{{ topic.score }}</span>
|
<span v-else>{{ topic.score }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-meta" v-if="topic.Offer.dealer_name">
|
<div class="card-meta" v-if="topic.Offer.dealer_name">
|
||||||
<span
|
<span
|
||||||
class="dealer-name dealer-label"
|
class="dealer-name dealer-label"
|
||||||
@@ -534,6 +493,7 @@ export default {
|
|||||||
v-html="highlightText(topic.Offer.dealer_name)"
|
v-html="highlightText(topic.Offer.dealer_name)"
|
||||||
></span>
|
></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-details" v-if="viewMode === 'cards'">
|
<div class="card-details" v-if="viewMode === 'cards'">
|
||||||
<div class="details-stats">
|
<div class="details-stats">
|
||||||
<div class="stat">
|
<div class="stat">
|
||||||
@@ -545,9 +505,11 @@ export default {
|
|||||||
<span class="stat-value">{{ topic.total_replies }} replies</span>
|
<span class="stat-value">{{ topic.total_replies }} replies</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-timestamp">First post: {{ formatDate(topic.post_time) }}</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 class="card-timestamp">Last post: {{ formatDate(topic.last_post_time) }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row-stats" v-if="viewMode === 'list'">
|
<div class="row-stats" v-if="viewMode === 'list'">
|
||||||
<span class="stat-compact">{{ formatDate(topic.post_time) }} - {{ formatDate(topic.last_post_time) }}</span>
|
<span class="stat-compact">{{ formatDate(topic.post_time) }} - {{ formatDate(topic.last_post_time) }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -556,8 +518,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<InfoOverlay :visible="infoOverlayVisible" @close="toggleInfoOverlay" />
|
</template>
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.cards-wrapper {
|
.cards-wrapper {
|
||||||
|
|||||||
@@ -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>
|
|
||||||
Reference in New Issue
Block a user