Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yhajiali authored Feb 19, 2024
0 parents commit 69de6f9
Show file tree
Hide file tree
Showing 13 changed files with 5,265 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Tweet Generator

This app generates engaging tweets for your brand.

This project is built using Nextjs. It utilizes the OpenAI GPT for chat completion, and Dall-E for image generation.

<img src="tweet-generator-demo.gif" alt="app demo" width=600>

## Getting Started

First, duplicate the `.env` file into a new file named `.env.local`. Update the value of your OpenAI API key there.

The first time you are running this project, you will need to install the dependencies. Run this command in your terminal:

```bash
yarn
```

To start the app, run:

```bash
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
Binary file added app/favicon.ico
Binary file not shown.
86 changes: 86 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

body {
background-color: rgb(21, 32, 43);
}

:root {
--twitter-blue: #1da1f2;
}

.container {
max-width: 1500px;
margin: 50px auto;
padding: 20px;
font-family: Arial, sans-serif;
}

h1 {
font-size: 50px;
text-align: center;
margin: 0 auto;
color: #fff;
}

.highlight {
color: var(--twitter-blue);
}

button:disabled,
button:disabled:hover {
background-color: #b7aeb9;
border-color: #b7aeb9;
color: white;
cursor: not-allowed;
opacity: 0.5;
}

.loading-wrapper {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 24px;
}

.loading-spinner {
display: inline-block;
width: 50px;
height: 50px;
border: 5px solid #fff;
border-radius: 50%;
border-top-color: var(--twitter-blue);
animation: spin 1s ease-in-out infinite;
-webkit-animation: spin 1s ease-in-out infinite;
}

.loading-wrapper span {
font-weight: 700;
color: var(--twitter-blue);
text-align: center;
}

@keyframes spin {
to {
-webkit-transform: rotate(360deg);
}
}

@-webkit-keyframes spin {
to {
-webkit-transform: rotate(360deg);
}
}

@media screen and (max-width: 640px) {
h1 {
font-size: 36px;
}
}
25 changes: 25 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import "./globals.css";
import type { Metadata } from "next";
import "@fortawesome/fontawesome-svg-core/styles.css";
import { config } from "@fortawesome/fontawesome-svg-core";
config.autoAddCss = false;

export const metadata: Metadata = {
title: "AI Tweet Generator",
description:
"A Tweet Generator that uses AI to generate tweets based on a topic and style.",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
<main>{children}</main>
</body>
</html>
);
}
18 changes: 18 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use client";

import Image from "next/image";
import TweetGenerator from "./components/TweetGenerator";

export default function Home() {
return (
<div className="container">
<h1>
<span className="highlight">Generate</span> your next
<br /> <span className="highlight">Tweet</span> using{" "}
<span className="highlight">AI</span>
</h1>

<TweetGenerator />
</div>
);
}
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
13 changes: 13 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**",
},
],
},
};

module.exports = nextConfig
29 changes: 29 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "codebender-ai-nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@types/node": "20.5.1",
"@types/react": "18.2.20",
"@types/react-dom": "18.2.7",
"ai": "^2.2.31",
"autoprefixer": "10.4.15",
"eslint": "8.47.0",
"eslint-config-next": "13.4.19",
"next": "13.4.19",
"openai": "^4.24.2",
"postcss": "8.4.28",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.1.6"
}
}
5 changes: 5 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {},
},
}
27 changes: 27 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Binary file added tweet-generator-demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 69de6f9

Please sign in to comment.