Skip to content

Commit

Permalink
deltamod
Browse files Browse the repository at this point in the history
  • Loading branch information
wadedesign committed Jun 30, 2024
1 parent 5485161 commit 0c4379f
Show file tree
Hide file tree
Showing 32 changed files with 3,436 additions and 294 deletions.
26 changes: 26 additions & 0 deletions app/api/contact/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { NextRequest, NextResponse } from 'next/server';

export async function POST(req: NextRequest) {
const { email, message } = await req.json();

if (!email || !message) {
return NextResponse.json({ message: 'Email and message are required' }, { status: 400 });
}

try {
const webhookURL = 'https://discord.com/api/webhooks/1256848824727634061/vR906lvVqAwDnsRTbicBCeachfE-uWhEUT4or4rybqge9PupewJ8htpk23Ded0Q_cKEM';
const payload = {
content: `New contact form submission:\n\n**Email:** ${email}\n**Message:** ${message}`,
};

await fetch(webhookURL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});

return NextResponse.json({ message: 'Message sent successfully' });
} catch (error) {
return NextResponse.json({ message: 'Failed to send message' }, { status: 500 });
}
}
11 changes: 11 additions & 0 deletions app/api/releases/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NextResponse } from 'next/server';

export async function GET() {
const response = await fetch('https://api.github.com/repos/yourusername/steam-mod-fetcher/releases');
if (!response.ok) {
return NextResponse.json({ error: 'Failed to fetch release notes' }, { status: response.status });
}

const data = await response.json();
return NextResponse.json(data);
}
43 changes: 43 additions & 0 deletions app/api/steam/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { NextRequest, NextResponse } from 'next/server';
import axios from 'axios';
import cheerio from 'cheerio';

interface Mod {
id: string;
name: string;
}

export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const url = searchParams.get('url');

if (!url) {
return NextResponse.json({ error: 'URL parameter is required' }, { status: 400 });
}

try {
const mods = await fetchSteamWorkshopMods(url);
console.log('Fetched mods:', mods); // Log the fetched mods
return NextResponse.json({ mods }, { status: 200 });
} catch (error) {
console.error('Error fetching mod details:', error);
return NextResponse.json({ error: 'Failed to fetch mod details' }, { status: 500 });
}
}

async function fetchSteamWorkshopMods(url: string): Promise<Mod[]> {
const response = await axios.get(url);
const html = response.data;
const $ = cheerio.load(html);

const mods: Mod[] = [];
$('.workshopItemTitle').each((_, element) => {
const id = $(element).closest('a').attr('href')?.split('id=')[1] || '';
const name = $(element).text().trim();
if (id && name) {
mods.push({ id, name });
}
});

return mods;
}
145 changes: 145 additions & 0 deletions app/components/Contact.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// app/components/Contact.tsx

'use client';

import React, { useState } from 'react';
import { Mail, Handshake, Gamepad, ArrowRight } from 'lucide-react';
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@/components/ui/card';
import { Separator } from '@/components/ui/separator';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
import { toast } from '@/components/ui/use-toast';
import { motion } from 'framer-motion';

const ContactMethod = ({ icon: Icon, title, description, link, linkText }: { icon: any, title: string, description: string, link?: string, linkText?: string }) => (
<motion.div
className="flex items-start space-x-4"
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5 }}
>
<Icon size={32} className="text-primary" />
<div>
<h4 className="text-lg font-medium">{title}</h4>
<p className="text-sm">{description}</p>
{link && (
<a href={link} target="_blank" rel="noopener noreferrer" className="text-sm text-primary hover:underline">
{linkText}
</a>
)}
</div>
</motion.div>
);

const Contact = () => {
const [email, setEmail] = useState('');
const [message, setMessage] = useState('');

const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();

try {
const response = await fetch('/api/contact', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, message }),
});

const result = await response.json();

if (response.ok) {
toast({
title: "Message Sent!",
description: "We've received your message and will get back to you soon.",
});
setEmail('');
setMessage('');
} else {
toast({
title: "Error",
description: result.message,
});
}
} catch (error) {
toast({
title: "Error",
description: "An unexpected error occurred.",
});
}
};

return (
<div className="container mx-auto px-4 py-8">
<motion.div
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5 }}
>
<Card className="mb-8">
<CardHeader>
<CardTitle className="text-3xl font-bold">Contact Us</CardTitle>
<CardDescription>Were excited to hear from you! Reach out through any of these channels:</CardDescription>
</CardHeader>
<CardContent>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<ContactMethod
icon={Handshake}
title="Join our Discord"
description="Connect with us and the community on our Discord server."
link="https://discord.gg/your-discord-link"
linkText="Join Discord"
/>
<ContactMethod
icon={Mail}
title="Email Us"
description="Send us an email for any inquiries or support."
link="mailto:contact@deltamod.com"
linkText="contact@deltamod.com"
/>
<ContactMethod
icon={Gamepad}
title="Delta Co Gaming"
description="Join our gaming servers where we play and run private servers using our own infrastructure. Games like Arma 3, Project Zomboid, and more!"
/>
</div>
</CardContent>
<Separator className="my-6" />
<CardFooter>
<form onSubmit={handleSubmit} className="space-y-4 w-full">
<div>
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
placeholder="your@email.com"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
/>
</div>
<div>
<Label htmlFor="message">Message</Label>
<Textarea
id="message"
placeholder="Your message here..."
value={message}
onChange={(e) => setMessage(e.target.value)}
required
/>
</div>
<Button type="submit" className="w-full">
Send Message <ArrowRight className="ml-2 h-4 w-4" />
</Button>
</form>
</CardFooter>
</Card>
</motion.div>
</div>
);
};

export default Contact;
58 changes: 58 additions & 0 deletions app/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// app/components/Footer.tsx

import React from 'react';
import Link from 'next/link';
import { Github, Twitter, Mail } from 'lucide-react';
import { Separator } from "@/components/ui/separator"

const Footer = () => {
const currentYear = new Date().getFullYear();

return (
<footer className="bg-background text-muted-foreground py-8 mt-auto">
<div className="container mx-auto px-4">
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
<div>
<h3 className="text-lg font-semibold text-primary mb-4">DeltaMod</h3>
<p className="text-sm">
Easily fetch and manage Steam mod information with DeltaMod.
</p>
</div>
<div>
<h4 className="text-base font-medium text-primary mb-4">Quick Links</h4>
<ul className="space-y-2">
<li><Link href="/" className="text-sm hover:text-primary transition-colors">Home</Link></li>
<li><Link href="/why-we-built-it" className="text-sm hover:text-primary transition-colors">Why We Built It</Link></li>
<li><Link href="/contact" className="text-sm hover:text-primary transition-colors">Contact</Link></li>
<li><Link href="/api" className="text-sm hover:text-primary transition-colors">API</Link></li>
</ul>
</div>
<div>
<h4 className="text-base font-medium text-primary mb-4">Connect</h4>
<div className="flex space-x-4">
<a href="https://github.com/yourusername/deltamod" target="_blank" rel="noopener noreferrer" className="hover:text-primary transition-colors">
<Github size={20} />
</a>
<a href="https://twitter.com/deltamod" target="_blank" rel="noopener noreferrer" className="hover:text-primary transition-colors">
<Twitter size={20} />
</a>
<a href="mailto:contact@deltamod.com" className="hover:text-primary transition-colors">
<Mail size={20} />
</a>
</div>
</div>
</div>
<Separator className="my-8" />
<div className="flex flex-col md:flex-row justify-between items-center">
<p className="text-sm">&copy; {currentYear} wadedev.us All rights reserved.</p>
<div className="flex space-x-4 mt-4 md:mt-0">
<Link href="/privacy" className="text-sm hover:text-primary transition-colors">Privacy Policy</Link>
<Link href="/terms" className="text-sm hover:text-primary transition-colors">Terms of Service</Link>
</div>
</div>
</div>
</footer>
);
};

export default Footer;
Loading

0 comments on commit 0c4379f

Please sign in to comment.