Skip to content

Commit 3bbcbcf

Browse files
committed
fix: responsive design
1 parent aba5562 commit 3bbcbcf

File tree

13 files changed

+211
-54
lines changed

13 files changed

+211
-54
lines changed

api-docs/docs.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,26 @@ const docTemplate = `{
10441044
}
10451045
}
10461046
},
1047+
"/api/v1/events": {
1048+
"get": {
1049+
"description": "Subscribe to server-sent events",
1050+
"produces": [
1051+
"text/event-stream"
1052+
],
1053+
"tags": [
1054+
"events"
1055+
],
1056+
"summary": "SSE Events",
1057+
"responses": {
1058+
"200": {
1059+
"description": "stream",
1060+
"schema": {
1061+
"type": "string"
1062+
}
1063+
}
1064+
}
1065+
}
1066+
},
10471067
"/api/v1/llm/config": {
10481068
"get": {
10491069
"security": [

api-docs/swagger.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,26 @@
10381038
}
10391039
}
10401040
},
1041+
"/api/v1/events": {
1042+
"get": {
1043+
"description": "Subscribe to server-sent events",
1044+
"produces": [
1045+
"text/event-stream"
1046+
],
1047+
"tags": [
1048+
"events"
1049+
],
1050+
"summary": "SSE Events",
1051+
"responses": {
1052+
"200": {
1053+
"description": "stream",
1054+
"schema": {
1055+
"type": "string"
1056+
}
1057+
}
1058+
}
1059+
}
1060+
},
10411061
"/api/v1/llm/config": {
10421062
"get": {
10431063
"security": [

api-docs/swagger.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,19 @@ paths:
14271427
summary: Validate OpenAI API Key
14281428
tags:
14291429
- config
1430+
/api/v1/events:
1431+
get:
1432+
description: Subscribe to server-sent events
1433+
produces:
1434+
- text/event-stream
1435+
responses:
1436+
"200":
1437+
description: stream
1438+
schema:
1439+
type: string
1440+
summary: SSE Events
1441+
tags:
1442+
- events
14301443
/api/v1/llm/config:
14311444
get:
14321445
description: Get the current active LLM configuration

cmd/server/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import (
2323
"scriberr/internal/transcription/adapters"
2424
"scriberr/internal/transcription/registry"
2525
"scriberr/pkg/logger"
26-
27-
_ "scriberr/api-docs" // Import generated Swagger docs
2826
)
2927

3028
// Version information (set by GoReleaser)

internal/api/router.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import (
77
"scriberr/pkg/middleware"
88

99
"github.com/gin-gonic/gin"
10-
swaggerFiles "github.com/swaggo/files"
11-
ginSwagger "github.com/swaggo/gin-swagger"
1210
)
1311

1412
// SetupRoutes sets up all API routes
@@ -46,9 +44,6 @@ func SetupRoutes(handler *Handler, authService *auth.AuthService) *gin.Engine {
4644
// Health check endpoint (no auth required)
4745
router.GET("/health", handler.HealthCheck)
4846

49-
// Swagger documentation
50-
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
51-
5247
// CLI install script alias (root level for easier access)
5348
router.GET("/install.sh", handler.GetInstallScript)
5449
router.GET("/install-cli.sh", handler.GetInstallScript)

web/project-site/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ install:
44
npm install
55

66
generate-api:
7-
cd ../.. && swag init -g server/main.go -o api-docs --dir cmd,internal
7+
cd ../.. && swag init -g server/main.go -o web/project-site/public/api --outputTypes json --dir cmd,internal
88

99
build: generate-api
1010
npm run build

web/project-site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7-
"sync:spec": "mkdir -p public/api && cp -f ../../api-docs/swagger.json public/api/swagger.json || echo 'No swagger.json found, skipping copy'",
7+
"sync:spec": "echo 'Swagger spec is generated by make generate-api'",
88
"sync:undoc": "node ./scripts/gen-endpoints.mjs",
99
"dev": "npm run sync:spec && npm run sync:undoc && vite",
1010
"build": "npm run sync:spec && npm run sync:undoc && tsc -b && vite build",

web/project-site/src/Layout.tsx

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import React from 'react';
22
import { Link, useLocation } from 'react-router-dom';
33
import { ScriberrLogo } from './components/ScriberrLogo';
4-
import { Github, Book, Code } from 'lucide-react';
5-
import { Button } from './components/ui/Button';
4+
import { Github, Book, Menu, X } from 'lucide-react';
5+
import { useState } from 'react';
6+
7+
8+
import { GithubBadge } from './components/GithubBadge';
69

710
interface LayoutProps {
811
children: React.ReactNode;
@@ -11,6 +14,7 @@ interface LayoutProps {
1114
export function Layout({ children }: LayoutProps) {
1215
const location = useLocation();
1316
const isDocs = location.pathname.startsWith('/docs');
17+
const [isMenuOpen, setIsMenuOpen] = useState(false);
1418

1519
return (
1620
<div className="min-h-screen flex flex-col font-sans selection:bg-[#FF6D20] selection:text-white">
@@ -22,33 +26,55 @@ export function Layout({ children }: LayoutProps) {
2226
<ScriberrLogo />
2327
</Link>
2428
{isDocs && (
25-
<span className="inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold bg-orange-100 text-[#FF6D20] border border-orange-200">
29+
<span className="inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold bg-orange-100 text-[#FF6D20] border border-orange-200 font-heading">
2630
Docs
2731
</span>
2832
)}
2933
</div>
3034

3135
<nav className="hidden md:flex items-center gap-8">
32-
<Link to="/#features" className="text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors">Features</Link>
33-
<Link to="/docs/intro" className="text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors">Documentation</Link>
34-
<Link to="/api" className="text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors">API</Link>
36+
<Link to="/docs/intro" className="text-sm text-gray-600 hover:text-gray-900 transition-colors font-heading">Documentation</Link>
37+
<Link to="/api" className="text-sm text-gray-600 hover:text-gray-900 transition-colors font-heading">API</Link>
3538
</nav>
3639

3740
<div className="flex items-center gap-4">
38-
<a
39-
href="https://github.com/rishikanthc/Scriberr"
40-
target="_blank"
41-
rel="noopener noreferrer"
42-
className="p-2 text-gray-500 hover:text-gray-900 transition-colors"
43-
aria-label="GitHub"
44-
>
45-
<Github className="w-5 h-5" />
46-
</a>
47-
<div className="hidden sm:block">
48-
<Button variant="primary" size="sm">Get Started</Button>
41+
<div className="hidden md:block">
42+
<GithubBadge />
4943
</div>
44+
<button
45+
onClick={() => setIsMenuOpen(!isMenuOpen)}
46+
className="md:hidden flex items-center justify-center w-10 h-10 rounded-xl bg-white/80 border border-gray-200 shadow-sm text-gray-600 hover:text-[#FF6D20] hover:border-orange-200 hover:bg-orange-50 transition-all duration-200"
47+
aria-label="Toggle menu"
48+
>
49+
{isMenuOpen ? <X className="w-5 h-5" strokeWidth={2.5} /> : <Menu className="w-5 h-5" strokeWidth={2.5} />}
50+
</button>
5051
</div>
5152
</div>
53+
54+
{/* Mobile Menu Overlay */}
55+
{isMenuOpen && (
56+
<div className="md:hidden absolute top-16 left-0 right-0 bg-white border-b border-gray-100 shadow-lg animate-fade-in z-40">
57+
<nav className="flex flex-col p-4 space-y-4">
58+
<Link
59+
to="/docs/intro"
60+
className="text-sm font-medium text-gray-600 hover:text-gray-900 py-2 border-b border-gray-50 font-heading"
61+
onClick={() => setIsMenuOpen(false)}
62+
>
63+
Documentation
64+
</Link>
65+
<Link
66+
to="/api"
67+
className="text-sm font-medium text-gray-600 hover:text-gray-900 py-2 border-b border-gray-50 font-heading"
68+
onClick={() => setIsMenuOpen(false)}
69+
>
70+
API
71+
</Link>
72+
<div className="pt-2">
73+
<GithubBadge />
74+
</div>
75+
</nav>
76+
</div>
77+
)}
5278
</header>
5379

5480
{/* Main Content */}
@@ -57,21 +83,23 @@ export function Layout({ children }: LayoutProps) {
5783
</main>
5884

5985
{/* Footer */}
60-
<footer className="border-t border-gray-100 bg-gray-50 py-12">
86+
<footer className="border-t border-gray-100 bg-gray-50 py-6">
6187
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex flex-col md:flex-row justify-between items-center gap-6">
6288
<div className="flex items-center gap-2">
6389
<span className="text-sm text-gray-500">© 2025 Scriberr. All rights reserved.</span>
6490
</div>
6591
<div className="flex items-center gap-6">
66-
<a href="#" className="text-gray-400 hover:text-gray-600 transition-colors">
92+
<a
93+
href="https://github.com/rishikanthc/scriberr"
94+
target="_blank"
95+
rel="noopener noreferrer"
96+
className="text-gray-400 hover:text-gray-600 transition-colors"
97+
>
6798
<Github className="w-5 h-5" />
6899
</a>
69-
<Link to="/docs" className="text-gray-400 hover:text-gray-600 transition-colors">
100+
<Link to="/docs/intro" className="text-gray-400 hover:text-gray-600 transition-colors">
70101
<Book className="w-5 h-5" />
71102
</Link>
72-
<a href="#" className="text-gray-400 hover:text-gray-600 transition-colors">
73-
<Code className="w-5 h-5" />
74-
</a>
75103
</div>
76104
</div>
77105
</footer>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { useEffect, useState } from 'react';
2+
import { Github, Star, GitFork } from 'lucide-react';
3+
4+
interface RepoStats {
5+
stargazers_count: number;
6+
forks_count: number;
7+
}
8+
9+
export function GithubBadge() {
10+
const [stats, setStats] = useState<RepoStats | null>(null);
11+
12+
useEffect(() => {
13+
fetch('https://api.github.com/repos/rishikanthc/scriberr')
14+
.then(res => res.json())
15+
.then(data => {
16+
setStats({
17+
stargazers_count: data.stargazers_count,
18+
forks_count: data.forks_count
19+
});
20+
})
21+
.catch(err => console.error('Failed to fetch repo stats:', err));
22+
}, []);
23+
24+
const formatCount = (count: number) => {
25+
if (count >= 1000) {
26+
return (count / 1000).toFixed(1) + 'k';
27+
}
28+
return count;
29+
};
30+
31+
return (
32+
<a
33+
href="https://github.com/rishikanthc/scriberr"
34+
target="_blank"
35+
rel="noopener noreferrer"
36+
className="group flex items-center gap-0 rounded-md overflow-hidden border border-gray-200 shadow-sm hover:shadow transition-all duration-200"
37+
>
38+
<div className="flex items-center gap-2 px-3 py-1.5 bg-gray-50 group-hover:bg-gray-100 transition-colors border-r border-gray-200">
39+
<Github className="w-4 h-4 text-gray-700" />
40+
<span className="text-xs font-semibold text-gray-700 font-heading">Star</span>
41+
</div>
42+
{stats && (
43+
<div className="flex items-center bg-white">
44+
<div className="flex items-center gap-1 px-2 py-1.5 border-r border-gray-100 last:border-0 hover:bg-gray-50 transition-colors">
45+
<Star className="w-3.5 h-3.5 text-amber-400 fill-amber-400" />
46+
<span className="text-xs font-medium text-gray-600 font-mono">{formatCount(stats.stargazers_count)}</span>
47+
</div>
48+
<div className="flex items-center gap-1 px-2 py-1.5 hover:bg-gray-50 transition-colors">
49+
<GitFork className="w-3.5 h-3.5 text-gray-400" />
50+
<span className="text-xs font-medium text-gray-600 font-mono">{formatCount(stats.forks_count)}</span>
51+
</div>
52+
</div>
53+
)}
54+
</a>
55+
);
56+
}

web/project-site/src/components/ui/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function Button({
1616
...props
1717
}: ButtonProps) {
1818

19-
const baseStyles = "inline-flex items-center justify-center font-medium transition-all duration-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed";
19+
const baseStyles = "cursor-pointer inline-flex items-center justify-center font-medium transition-all duration-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed";
2020

2121
const variants = {
2222
primary: "bg-gray-900 text-white shadow-lg hover:shadow-xl hover:-translate-y-0.5 focus:ring-gray-900",

0 commit comments

Comments
 (0)