import { Box, Link, Image, Button, Heading, Text, Card, Flex } from 'theme-ui'
import Head from 'next/head'
import Meta from '@hackclub/meta'
import Footer from '../components/footer'
import Nav from '../components/nav'
import ForceTheme from '../components/force-theme'
import ReplitForm from '../components/replit/form'
import Progress from '../components/replit/progress'
import TokenInstructions from '../components/replit/token-instructions'
import { useEffect, useState } from 'react'
import ScaleUp from '../components/replit/scale-up'
const ReplitPage = () => {
const [progress, setProgress] = useState(null)
const [stats, setStats] = useState(null)
const [oldStats, setOldStats] = useState(null)
const fetchStats = async () => {
const statResponse = await fetch('/api/replit/stats')
if (!statResponse.ok) throw new Error('Failed to fetch stats')
const newStats = await statResponse.json()
setOldStats(stats)
setStats(newStats)
}
useEffect(async () => {
await fetchStats()
const interval = setInterval(async () => {
const token = localStorage.getItem('token')
if (!token) return
try {
const response = await fetch(`/api/replit/progress?token=${token}`)
if (!response.ok) throw new Error('Failed to fetch progress')
const data = await response.json()
console.info(data)
setProgress(data)
await fetchStats()
} catch (err) {
console.error("Couldn't get progress:", err)
}
}, 5_000)
return () => clearInterval(interval)
}, [])
const steps = [
'Enter your email',
'Enter your replit token',
'Get free stickers'
]
const cssDark = 'hsl(23, 94%, 32%)'
return (
<>
Replit Lifeboat:{' '}
Save Our Ships
🛟
🛳️
🚤
🌊
⛵
Export your{' '}
{
document.getElementById('og-replit').style.opacity = '0'
document.getElementById('fire-replit').style.opacity = '1'
}}
onMouseOut={() => {
document.getElementById('og-replit').style.opacity = '1'
document.getElementById('fire-replit').style.opacity = '0'
}}
*/
>
Replit
{/*
*/}
{' '}
repls
Replit cut down its free plan - many students can't afford to keep
using it.
We quickly built this project exporter. It's the only way to download
your repls with edit history intact (as a git repo).
Written in Rust &{' '}
open source
.{' '}
{stats ? (
{' '}
files &{' '}
{' '}
repls exported.
) : null}
{steps.map((step, idx) => (
{idx + 1}
{step}
))}
How to get your Replit connect.sid token
>
)
}
export default ReplitPage