Skip to content

Commit 277f989

Browse files
committed
feat: re-added missing demo page
1 parent 6507561 commit 277f989

File tree

7 files changed

+342
-249
lines changed

7 files changed

+342
-249
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"dev": "next dev",
77
"build": "next build",
88
"postbuild": "cp -f static/.htaccess out/.htaccess || true",
9-
"start": "next start",
109
"lint": "next lint",
1110
"test": "vitest",
1211
"test:ui": "vitest --ui",
@@ -36,10 +35,10 @@
3635
"@testing-library/jest-dom": "^6.9.1",
3736
"@testing-library/react": "^16.3.0",
3837
"@testing-library/user-event": "^14.6.1",
39-
"@types/node": "^20.19.22",
38+
"@types/node": "^20.19.24",
4039
"@types/react": "^19.2.2",
4140
"@types/react-dom": "^19.2.2",
42-
"@vitejs/plugin-react": "^5.0.4",
41+
"@vitejs/plugin-react": "^5.1.0",
4342
"@vitest/coverage-v8": "3.2.4",
4443
"eslint": "^8.57.1",
4544
"eslint-config-next": "15.5.4",

pnpm-lock.yaml

Lines changed: 234 additions & 233 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/demo/page.test.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { describe, it, expect, vi } from 'vitest'
2+
import { render, screen } from '@testing-library/react'
3+
import DemoPage from './page'
4+
5+
vi.mock('@/lib/data', () => ({
6+
getVersions: () => ({ stable: '4.0.13', development: '4.1.0-alpha.3' })
7+
}))
8+
9+
describe('DemoPage', () => {
10+
it('renders title and credentials', () => {
11+
render(<DemoPage />)
12+
expect(screen.getByText('Demo')).toBeInTheDocument()
13+
expect(screen.getByText(/Admin user/i)).toBeInTheDocument()
14+
expect(screen.getByText(/Normal user/i)).toBeInTheDocument()
15+
expect(screen.getAllByText(/demoadmin/i)[0]).toBeInTheDocument()
16+
expect(screen.getAllByText(/demouser/i)[0]).toBeInTheDocument()
17+
})
18+
19+
it('shows stable demo link', () => {
20+
render(<DemoPage />)
21+
const link = screen.getByRole('link', { name: /phpMyFAQ 4.0.13/i })
22+
expect(link).toHaveAttribute('href', 'https://roy.demo.phpmyfaq.de/')
23+
})
24+
})

src/app/demo/page.tsx

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import PageLayout, { generatePageMetadata } from '@/components/PageLayout'
2+
import { getVersions } from '@/lib/data'
3+
import type { Metadata } from 'next'
4+
5+
export const metadata: Metadata = generatePageMetadata(
6+
'Demo installations',
7+
'phpMyFAQ 4.0 demo versions'
8+
)
9+
10+
export default function DemoPage() {
11+
const versions = getVersions()
12+
13+
const fallback = {
14+
stable: '4.0.13',
15+
development: '4.1.0-alpha.3',
16+
}
17+
18+
const stableVersion = versions?.stable || fallback.stable
19+
const devVersion = versions?.development || fallback.development
20+
21+
return (
22+
<PageLayout title="Demo" description="phpMyFAQ 4.0 demo versions">
23+
<p className="lead">You can test all these phpMyFAQ installations with the following credentials:</p>
24+
25+
<div className="row mb-4">
26+
<div className="col-md-6 col-12">
27+
<h4>Admin user</h4>
28+
<dl className="row">
29+
<dt className="col-sm-3">Username</dt>
30+
<dd className="col-sm-9"><code>demoadmin</code></dd>
31+
<dt className="col-sm-3">Password</dt>
32+
<dd className="col-sm-9"><code>demoadmin</code></dd>
33+
</dl>
34+
</div>
35+
<div className="col-md-6 col-12">
36+
<h4>Normal user</h4>
37+
<dl className="row">
38+
<dt className="col-sm-3">Username</dt>
39+
<dd className="col-sm-9"><code>demouser</code></dd>
40+
<dt className="col-sm-3">Password</dt>
41+
<dd className="col-sm-9"><code>demouser</code></dd>
42+
</dl>
43+
</div>
44+
</div>
45+
46+
<div className="row gy-4">
47+
<div className="col-md-6 col-12">
48+
<h2 className="h4">phpMyFAQ {stableVersion}</h2>
49+
<ul className="list-unstyled text-center m-0">
50+
<li>
51+
<a className="btn btn-primary" rel="nofollow" target="_blank" href="https://roy.demo.phpmyfaq.de/">
52+
phpMyFAQ {stableVersion}
53+
</a>
54+
</li>
55+
</ul>
56+
</div>
57+
<div className="col-md-6 col-12">
58+
<h2 className="h4">phpMyFAQ {devVersion}</h2>
59+
<ul className="list-unstyled text-center m-0">
60+
<li>n/a{/*
61+
<a className=\"btn btn-primary\" rel=\"nofollow\" target=\"_blank\" href=\"https://moss.demo.phpmyfaq.de/\">
62+
phpMyFAQ {devVersion}
63+
</a>
64+
*/}
65+
</li>
66+
</ul>
67+
</div>
68+
</div>
69+
70+
<div className="row mt-4">
71+
<div className="col-12">
72+
<p>You can do whatever you want with these installations, the installations will be reset every day.</p>
73+
</div>
74+
</div>
75+
</PageLayout>
76+
)
77+
}

src/components/Hero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function Hero() {
1111
</p>
1212

1313
<div className="btns">
14-
<a className="btn btn-outline-light me-2" href="http://demo.phpmyfaq.de/">Demo</a>
14+
<Link href="/demo" className="btn btn-outline-light me-2">Demo</Link>
1515
<Link href="/download" className="btn btn-light">Download phpMyFAQ</Link>
1616
</div>
1717
<p className="love-phpmyfaq">

src/components/Sponsors.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@ export default function Sponsors() {
77
<div className="text-center" style={{fontSize: '10px', marginTop: '20px'}}>
88
<strong>SPONSORED BY</strong>
99
<br/>
10-
{/* 2025-10-03 - XXXX */}
11-
<a target="_blank" href="http://phonebillcasino.co.uk/">Phonebillcasino.co.uk</a> specialise in all
12-
aspects of
13-
mobile billing, this includes being able to
14-
<a target="_blank" href="https://phonebillcasino.co.uk/bet-mobile-phone-credit-sites/">bet using phone
15-
bill at online bookmakers</a>.
16-
<br/>
17-
Play the latest
18-
<a target="_blank" href="http://mobilebingobonuses.co.uk">mobilebingobonuses.co.uk</a>
19-
at some of the best casino sites in the UK
20-
<br/>
2110
{/* 2026-04-21 */}
2211
Find the best online casinos, <a target="_blank" href="https://www.kasinohai.com/parhaat-nettikasinot">parhaat
2312
nettikasinot</a> in Finnish, on Kasinohai

tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
"next-env.d.ts",
3636
"src/**/*.ts",
3737
"src/**/*.tsx",
38-
"out/types/**/*.ts"
38+
"out/types/**/*.ts",
39+
40+
41+
3942
],
4043
"exclude": [
4144
"node_modules"

0 commit comments

Comments
 (0)