Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 0 additions & 111 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ export default async (): Promise<Config> => {
} else if (
entry.name.endsWith('.mbt') ||
entry.name.endsWith('.mbti') ||
entry.name === 'moon.pkg' ||
entry.name === 'moon.pkg.json' ||
entry.name === 'moon.mod.json'
) {
Expand Down Expand Up @@ -247,116 +246,6 @@ export default async (): Promise<Config> => {
},
}
},
// In dev mode, watch showcase .mbt source files and run moon build on
// each change, then copy output to static/rabbita-2026-scc-showcase/
// for Docusaurus to serve.
function rabbitaShowcasePlugin() {
const showcaseDir = path.join(
process.cwd(),
'src',
'rabbita',
'2026-scc-showcase'
)
const staticDir = path.join(
process.cwd(),
'static',
'rabbita-2026-scc-showcase'
)
const stylesSrc = path.join(showcaseDir, 'styles.css')

function collectWatchFiles(dir: string, files: string[] = []): string[] {
const skip = new Set(['node_modules', '_build', 'target', '.git'])
for (const entry of readdirSync(dir, { withFileTypes: true })) {
if (skip.has(entry.name)) continue
const full = path.join(dir, entry.name)
if (entry.isDirectory()) {
collectWatchFiles(full, files)
} else if (
entry.name.endsWith('.mbt') ||
entry.name.endsWith('.mbti') ||
entry.name === 'moon.pkg' ||
entry.name === 'moon.pkg.json' ||
entry.name === 'moon.mod.json'
) {
files.push(full)
}
}
return files
}

function findFirstJs(dir: string): string | null {
for (const entry of readdirSync(dir, { withFileTypes: true })) {
const full = path.join(dir, entry.name)
if (entry.isDirectory()) {
const found = findFirstJs(full)
if (found) return found
} else if (entry.name.endsWith('.js')) {
return full
}
}
return null
}

function buildAndCopy(): void {
const result = spawnSync('moon', ['build', '--target', 'js', '--debug'], {
cwd: showcaseDir,
stdio: 'inherit',
})
if (result.status !== 0) return
const buildDir = path.join(showcaseDir, '_build', 'js', 'debug', 'build')
if (!existsSync(buildDir)) return
const jsFile = findFirstJs(buildDir)
if (!jsFile) return
if (!existsSync(staticDir)) mkdirSync(staticDir, { recursive: true })
const code = readFileSync(jsFile, 'utf8')
.replace(/\n?\/\/[#@]\s*sourceMappingURL=.*$/m, '')
.replace(/\n?\/\*#\s*sourceMappingURL=.*?\*\//m, '')
writeFileSync(path.join(staticDir, 'main.js'), code)
if (existsSync(stylesSrc)) {
copyFileSync(stylesSrc, path.join(staticDir, 'styles.css'))
}
}

return {
name: 'rabbita-showcase',
getPathsToWatch() {
const files = collectWatchFiles(showcaseDir)
if (existsSync(stylesSrc)) files.push(stylesSrc)
return files
},
async loadContent() {
if (process.env.NODE_ENV === 'development') {
buildAndCopy()
}
return null
},
injectHtmlTags() {
if (process.env.NODE_ENV !== 'development') return {}
return {
headTags: [
{
tagName: 'script',
innerHTML: `
(function () {
var known = null;
setInterval(async function () {
if (!document.getElementById('rabbita-scc-showcase')) return;
try {
var r = await fetch('/rabbita-2026-scc-showcase/main.js', { method: 'HEAD', cache: 'no-store' });
if (!r.ok) return;
var tag = r.headers.get('etag') || r.headers.get('last-modified');
if (known === null) { known = tag; return; }
if (tag !== known) { known = tag; location.reload(); }
} catch (e) {}
}, 500);
})();
`,
},
],
}
},
}
},
[
'./plugins/blog-plugin',
{
Expand Down
8 changes: 1 addition & 7 deletions i18n/zh/docusaurus-plugin-content-pages/2026-scc/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ContestLayout from '@site/src/components/ContestLayout'
import ContestNavbar, { items2026 } from '@site/src/components/ContestNavbar'
import styles from '@site/src/pages/2026-scc/styles.module.css'

export default function Page() {
Expand All @@ -8,11 +7,9 @@ export default function Page() {
heroImg='/img/2026-contest/kv.jpg'
mobileHeroImg='/img/2026-contest/kv.jpg'
qqGroupImg='/img/2026-contest/qq-group.png'
heroBgColor='#09184c'
heroBackdropImg='/img/2026-contest/kv.jpg'
heroBgColor='#051033'
>
<div className={styles.container}>
<ContestNavbar activeIndex={0} items={items2026} qqGroup={false} />
<ChineseContent />
</div>
</ContestLayout>
Expand Down Expand Up @@ -51,9 +48,6 @@ function ChineseContent() {
>
立即报名
</a>
<a href='/2026-scc/showcase/' className='button button--primary button--lg'>
查看作品
</a>
</div>
</section>

Expand Down

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start --host 0.0.0.0",
"dev": "pnpm rabbita-home:build && pnpm rabbita-showcase:build && (cd src/pages/rabbita-home && npm run watch &) && docusaurus start --host 0.0.0.0",
"dev": "pnpm rabbita-home:build && (cd src/pages/rabbita-home && npm run watch &) && docusaurus start --host 0.0.0.0",
"data": "tsx ./scripts/gen-data.ts",
"build": "pnpm rabbita-home:build && pnpm rabbita-showcase:build && docusaurus build",
"build": "pnpm rabbita-home:build && docusaurus build",
"rabbita-home:build": "node ./scripts/build-rabbita-home.mjs",
"rabbita-showcase:build": "node ./scripts/build-rabbita-showcase.mjs",
"postbuild": "cp -R static-gallery/* build/gallery/",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
Expand Down
56 changes: 0 additions & 56 deletions scripts/build-rabbita-showcase.mjs

This file was deleted.

29 changes: 4 additions & 25 deletions src/components/ContestLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import Layout from '@theme/Layout'
import styles from './styles.module.css'
import type { CSSProperties } from 'react'

type HeroProps = {
img: string
mobileHeroImg: string
bgColor?: string
backdropImg?: string
}

type LayoutProps = {
Expand All @@ -15,28 +13,14 @@ type LayoutProps = {
qqGroupImg?: string
qqGroupId?: string
heroBgColor?: string
heroBackdropImg?: string
children: React.ReactNode
}

export default function ContestLayout(props: LayoutProps) {
const {
heroImg,
mobileHeroImg,
children,
qqGroupId,
qqGroupImg,
heroBgColor,
heroBackdropImg
} = props
const { heroImg, mobileHeroImg, children, qqGroupId, qqGroupImg, heroBgColor } = props
return (
<Layout>
<Hero
img={heroImg}
mobileHeroImg={mobileHeroImg}
bgColor={heroBgColor}
backdropImg={heroBackdropImg}
/>
<Hero img={heroImg} mobileHeroImg={mobileHeroImg} bgColor={heroBgColor} />
<main>
{qqGroupImg && (
<div className={styles['qq-group']}>
Expand All @@ -57,14 +41,9 @@ export default function ContestLayout(props: LayoutProps) {
)
}

function Hero({ img, mobileHeroImg, bgColor, backdropImg }: HeroProps) {
const style: CSSProperties & Record<'--hero-bg-image' | '--hero-bg-color', string> = {
'--hero-bg-color': bgColor || 'black',
'--hero-bg-image': backdropImg ? `url(${backdropImg})` : 'none'
}

function Hero({ img, mobileHeroImg, bgColor }: HeroProps) {
return (
<div className={styles['hero']} style={style}>
<div className={styles['hero']} style={bgColor ? { backgroundColor: bgColor } : undefined}>
<img className={styles['hero-img']} src={img} alt='' />
<img className={styles['mobile-hero-img']} src={mobileHeroImg} alt='' />
</div>
Expand Down
35 changes: 1 addition & 34 deletions src/components/ContestLayout/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,39 +1,11 @@
.hero {
position: relative;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
isolation: isolate;
background-color: var(--hero-bg-color, black);
}

.hero::before {
content: '';
position: absolute;
inset: 0;
background-image: var(--hero-bg-image, none);
background-position: center;
background-size: cover;
background-repeat: no-repeat;
filter: blur(22px) saturate(0.9);
transform: scale(1.08);
opacity: 0.88;
pointer-events: none;
}

.hero::after {
content: '';
position: absolute;
inset: 0;
background:
linear-gradient(180deg, rgba(4, 8, 18, 0.08), rgba(4, 8, 18, 0.16));
pointer-events: none;
background-color: black;
}

.hero img {
position: relative;
z-index: 1;
width: 100%;
max-width: 1200px;
}
Expand All @@ -47,11 +19,6 @@
}

@media (max-width: 996px) {
.hero::before {
filter: blur(14px) saturate(0.92);
transform: scale(1.04);
}

.mobile-hero-img {
display: block;
}
Expand Down
8 changes: 1 addition & 7 deletions src/components/ContestNavbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,7 @@ export const items2025en: ContestNavbarItem[] = [
]

export const items2026: ContestNavbarItem[] = [
{ name: '赛事章程', href: '/2026-scc' },
{ name: '作品展示墙', href: '/2026-scc/showcase' }
]

export const items2026en: ContestNavbarItem[] = [
{ name: 'Regulations', href: '/2026-scc' },
{ name: 'Showcase Wall', href: '/2026-scc/showcase' }
{ name: '赛事章程', href: '/2026-scc' }
]

export default function ContestNavbar({
Expand Down
Loading
Loading