Skip to content

Commit

Permalink
edit readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sangdth committed Dec 15, 2023
1 parent e2a3146 commit 44f9d3e
Show file tree
Hide file tree
Showing 4 changed files with 240 additions and 16 deletions.
16 changes: 7 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=topsecret
NEXTAUTH_URL=http://localhost:3000

# --- Start for development
POSTGRES_DB=postgres
Expand All @@ -17,13 +17,11 @@ DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTG
# GITHUB_ORG=

# Use this one for magic link authentication
SMTP_USER=mailpit
SMTP_PASSWORD=topsecret
SMTP_HOST=0.0.0.0
SMTP_PORT=1025
EMAIL_FROM="Sieutoc Team <[email protected]>"
# SMTP_USER=mailpit
# SMTP_PASSWORD=topsecret
# SMTP_HOST=0.0.0.0
# SMTP_PORT=1025
# EMAIL_FROM="Sieutoc Team <[email protected]>"

EASYPANEL_API_KEY=
EASYPANEL_URL=

STRIPE_SECRET_KEY=
EASYPANEL_API_KEY=
44 changes: 37 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<img alt="Sieutoc" src="https://github.com/websitesieutoc/platform/assets/1083478/85190f2c-a300-4f2d-bbb2-00cc632c80cf">

<img alt="Sieutoc" src="https://github.com/websitesieutoc/platform/assets/1083478/85190f2c-a300-4f2d-bbb2-00cc632c80cf">

<h1 align="center">Sieutoc Platform</h1>

<h1 align="center">Sieutoc Platform</h1>

<p align="center">
Create modern apps easier
Create modern apps easier
</p>

<br/>
Expand All @@ -14,7 +12,7 @@ Create modern apps easier

This template includes the following:

- Next.js 13
- Next.js 14
- TypeScript
- ESLint
- Prettier
Expand All @@ -25,6 +23,7 @@ This template includes the following:
- PostgresQL
- Redis
- Mailpit
- And plenty of well-crafted components like HeroSection, Features, Pricings, SubscribeForm etc.

## Demo

Expand Down Expand Up @@ -61,18 +60,49 @@ cd your-project
pnpm install
```

#### Setup environment variables
## Setup environment variables

For the first time, you need some default environment variables:

```bash
cp .env.example .env
```

#### If you want to use magic link login

Uncomment the `SMPT` section in `.env` file. By default we already set Mailpit for you.

The mailbox can be reach at http://localhost:8025


#### If you want to use GitHub login

Uncomment the `GITHUB` section in .env file. Follow this [documentation](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app) to configure the authentication.

#### Let's get started!

Then, run the development server:

```bash
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser and start developing.

## Further instructions

Currently we leave only EasyPanel helper actions along with its templates. This is heavy and repetitive task that's why we don't want to add all the templates from EasyPanel.

The main idea of this platform is, you can use it to quickly start developing a product/service and serve your customers right away.

It does not mean to replace the EasyPanel product.

To use EasyPanel function, you need to obtain and set up the .env file:

```bash
EASYPANEL_URL=https://your-easypanel.url
EASYPANEL_API_KEY=your-easypanel-apikey
```

NOTE: The actions by default will create new project for 1-1 match with our platform Project. The free version of EasyPanel only supports 3 projects!
Make sure to upgrade your EasyPanel license.
93 changes: 93 additions & 0 deletions components/client/ProButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
'use client';

import {
ButtonProps,
Button,
ModalCloseButton,
ModalContent,
ModalOverlay,
ModalHeader,
ModalBody,
Modal,
Stack,
Heading,
Text,
ModalFooter,
ListItem,
List,
ListIcon,
Badge,
Flex,
} from '@/components/chakra';
import { CheckIcon, PremiumIcon } from '@/icons';
import { forwardRef, useState } from 'react';
import { FEATURES } from '@/lib/constants';
import { useDisclosure } from '@/hooks';

export type ProButtonProps = ButtonProps;

export const ProButton = forwardRef<HTMLButtonElement, ProButtonProps>((props, ref) => {
const { isOpen, onOpen, onClose } = useDisclosure();
const [isYearly, setYearly] = useState(true);

const billMode = isYearly ? 'yearly' : 'monthly';

return (
<>
<Button ref={ref} leftIcon={<PremiumIcon />} onClick={onOpen} {...props} />
<Modal size="lg" isOpen={isOpen} onClose={onClose}>
<ModalOverlay />
<ModalContent as={Stack} spacing={2}>
<ModalHeader>
<PremiumIcon /> Pika Pro
</ModalHeader>
<ModalCloseButton />
<ModalBody as={Stack} spacing={6}>
<Flex justify="space-between" align="center">
<Heading size="md" textAlign="start">
Billed {billMode}
<Badge
py={1}
px={2}
marginLeft={2}
marginBottom={1}
fontSize="0.9em"
variant="outline"
borderRadius="lg"
colorScheme="green"
textTransform="lowercase"
>
${FEATURES['PRO'].price[billMode]}/month
</Badge>
</Heading>

<Button size="xs" variant="ghost" onClick={() => setYearly(!isYearly)}>
Switch to {isYearly ? 'monthly' : 'yearly'}
</Button>
</Flex>
<List spacing={1}>
{FEATURES['PRO'].features.map((feature, index) => (
<ListItem key={`feature-${index}`}>
<Stack direction="row" align="flex-start" spacing={1}>
<ListIcon as={CheckIcon} color="brand.500" boxSize={2} mt={2} />
<Text>{feature}</Text>
</Stack>
</ListItem>
))}
</List>
</ModalBody>

<ModalFooter as={Stack} spacing={6}>
<Button size="lg" colorScheme="brand" onClick={onClose}>
Upgrade to Pro (billed {billMode})
</Button>

<Button size="xs" variant="link" onClick={onClose}>
Compare plans
</Button>
</ModalFooter>
</ModalContent>
</Modal>
</>
);
});
103 changes: 103 additions & 0 deletions components/client/SubscribeForm/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
'use client';

import {
Button,
FormControl,
FormLabel,
Heading,
Input,
SimpleGrid,
Stack,
Text,
} from '@/components/chakra';
import { useColorModeValue, useState, useToast } from '@/hooks';
import { HttpMethod, SubscribeResponse } from '@/types';
import { NextLink } from '@/components/client';
import { fetcher } from '@/lib/utils';

export type SubscribeFormProps = {
heading?: string;
lists: number[];
};

export const SubscribeForm = ({
heading = 'Subscribe for updates',
lists,
}: SubscribeFormProps) => {
const inputBgColor = useColorModeValue('gray.100', 'gray.800');
const [email, setEmail] = useState('');
const [name, setName] = useState('');
const { toast } = useToast();

const handleSubscribe = async () => {
const response = await fetcher<SubscribeResponse>('/api/mailinglist/subscribers', {
method: HttpMethod.POST,
body: JSON.stringify({
name: name ? name : 'subscriber',
status: 'enabled',
lists,
email,
}),
});

if (response.data) {
toast({ description: 'Successfully subscribed! Please check your mailbox' });
} else {
toast({ description: 'Something wrong, please contact support', status: 'error' });
}
};

return (
<SimpleGrid
minChildWidth="300px"
alignItems="center"
maxW="container.lg"
spacingX={10}
spacingY={10}
my={8}
>
<Stack spacing={0}>
<Heading as="h3" fontSize="3xl" fontWeight="bold">
{heading}
</Heading>
<Text fontSize="sm">
By subscribing, you agree with our{' '}
<Button as={NextLink} size="sm" variant="link" href="/">
Terms
</Button>{' '}
and{' '}
<Button as={NextLink} size="sm" variant="link" href="/">
Privacy Policy.
</Button>
</Text>
</Stack>
{name && (
<FormControl as={Stack} direction="row">
<FormLabel>Name</FormLabel>
<Input
onChange={(e) => setName(e.target.value)}
focusBorderColor="brand.500"
bgColor={inputBgColor}
value={name}
name="name"
size="lg"
/>
</FormControl>
)}
<FormControl as={Stack} direction="row">
<FormLabel hidden>Subscribe</FormLabel>
<Input
onChange={(e) => setEmail(e.target.value)}
focusBorderColor="brand.500"
bgColor={inputBgColor}
value={email}
type="email"
size="lg"
/>
<Button colorScheme="brand" size="lg" onClick={handleSubscribe}>
Subscribe
</Button>
</FormControl>
</SimpleGrid>
);
};

0 comments on commit 44f9d3e

Please sign in to comment.