Skip to content

Commit

Permalink
Remove course page and update newsletter form
Browse files Browse the repository at this point in the history
  • Loading branch information
255kb committed Aug 14, 2024
1 parent 739b08b commit 875fc02
Show file tree
Hide file tree
Showing 24 changed files with 43 additions and 425 deletions.
27 changes: 7 additions & 20 deletions components/email-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import FormHoneypot from './form-honeypot';
import Spinner from './spinner';

const EmailForm: FunctionComponent<{
formType: 'newsletter' | 'productUpdates' | 'coursePreview';
}> = function ({ formType }) {
type: 'newsletter' | 'update';
}> = function ({ type }) {
const {
register: registerFormField,
handleSubmit,
Expand All @@ -19,23 +19,10 @@ const EmailForm: FunctionComponent<{
if (!data['work_address']) {
delete data['work_address'];

if (formType === 'newsletter') {
data = {
...data,
...{
newsletter: true,
productUpdates: true,
coursePreview: true
}
};
} else {
data = {
...data,
...{
[formType]: true
}
};
}
data = {
...data,
newsletter: true
};

try {
const response = await fetch(
Expand Down Expand Up @@ -83,7 +70,7 @@ const EmailForm: FunctionComponent<{
type='submit'
disabled={isSubmitting}
>
{formType === 'newsletter' ? 'Subscribe' : 'Keep me posted'}
{type === 'newsletter' ? 'Subscribe' : 'Keep me posted'}
</button>
</div>
{isSubmitting && (
Expand Down
7 changes: 1 addition & 6 deletions components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Footer: FunctionComponent<{
</p>
</div>
<div className='col-lg-5 justify-content-end'>
<EmailForm formType='newsletter' />
<EmailForm type='newsletter' />
</div>
</div>
)) ||
Expand Down Expand Up @@ -159,11 +159,6 @@ const Footer: FunctionComponent<{
Video tutorials
</Link>
</li>
<li className='mb-2'>
<Link href='/course/' className='text-reset'>
Online Course
</Link>
</li>
<li className='mb-2'>
<Link href='/training/' className='text-reset'>
Training
Expand Down
8 changes: 0 additions & 8 deletions components/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,6 @@ const Nav: FunctionComponent = function () {
Live Training{' '}
<i className='icon-new_releases text-warning'></i>
</Link>
<Link
href='/course/'
className={`dropdown-item ${
router.pathname === '/course' ? 'active' : ''
}`}
>
Online Course
</Link>
<Link
href='/docs/latest/about/'
className={`dropdown-item ${
Expand Down
5 changes: 0 additions & 5 deletions content/blog/december-2023-news.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ The API playground is available at `https://playground.mockoon.com` and was buil

![screenshot of the API playground in mockoon desktop{1175x632}](/images/blog/december-2023-news/creating-crud-endpoints-mockoon-desktop.png)

## 🧑‍🏫 Official course

We started working on an **official course** to help you get started with Mockoon. It should be available in the first quarter of 2024.
You can already [subscribe to the waiting list](/course/) to be notified when it's ready and get a special discount.

## 🔎 Website search

We added a **search feature** to the website covering all the pages, tutorials, documentation, or mock samples. No more being lost in the documentation!
Expand Down
2 changes: 0 additions & 2 deletions content/docs/latest/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v5.1.0/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v6.0.1/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v6.1.0/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v6.2.0/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v7.0.0/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v8.0.0/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v8.1.0/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v8.1.1/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v8.2.0/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
2 changes: 0 additions & 2 deletions content/docs/v8.3.0/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ You will find the [CLI documentation](https://github.com/mockoon/mockoon/blob/ma
## Serverless documentation

You will find the [serverless package documentation](https://github.com/mockoon/mockoon/blob/main/packages/serverless/README.md) in its dedicated readme file on the repository. It covers the package usage instructions and specific features.

> 🎓 Discover our official online course designed to help you get started with API mocking and API design. Coming soon! [Learn more](/course/)
5 changes: 5 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
"destination": "/pricing/",
"type": 301
},
{
"source": "/course/",
"destination": "/training/",
"type": 301
},
{
"source": "/account",
"destination": "/account/info/",
Expand Down
4 changes: 0 additions & 4 deletions models/user.model.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
export type EmailingContact = {
email: string;
newsletter: boolean;
productUpdates: boolean;
coursePreview: boolean;
};

export type EmailingStatuses = {
newsletter: boolean;
productUpdates: boolean;
coursePreview: boolean;
};
62 changes: 1 addition & 61 deletions pages/account/notifications.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useMutation } from '@tanstack/react-query';
import Link from 'next/link';
import { useRouter } from 'next/router';
import { FunctionComponent, useEffect } from 'react';
import { useForm, useWatch } from 'react-hook-form';
Expand Down Expand Up @@ -45,23 +44,11 @@ const AccountNotifications: FunctionComponent = function () {
shouldDirty: false,
shouldTouch: false
});
setValue('productUpdates', emailingData.productUpdates, {
shouldDirty: false,
shouldTouch: false
});
setValue('coursePreview', emailingData.coursePreview, {
shouldDirty: false,
shouldTouch: false
});
}
}, [emailingData]);

const { mutate: updateEmailing } = useMutation({
mutationFn: async (data: {
newsletter: boolean;
productUpdates: boolean;
coursePreview: boolean;
}) => {
mutationFn: async (data: { newsletter: boolean }) => {
const response = await fetch(
`${process.env.NEXT_PUBLIC_BACKEND_URL}/user/emailing`,
{
Expand Down Expand Up @@ -160,53 +147,6 @@ const AccountNotifications: FunctionComponent = function () {
</div>
</div>
</div>

<div className='list-group-item'>
<div className='row align-items-center'>
<div className='col'>
<p className='mb-0'>Mockoon Cloud updates</p>

<small className='text-gray-700'>
Be notified when new{' '}
<Link href={'/cloud/'}>Cloud</Link> features are
released
</small>
</div>
<div className='col-auto'>
<div className='form-check form-switch'>
<input
className='form-check-input'
type='checkbox'
id='productUpdates'
{...registerFormField('productUpdates')}
/>
</div>
</div>
</div>
</div>
<div className='list-group-item'>
<div className='row align-items-center'>
<div className='col'>
<p className='mb-0'>Online course release</p>

<small className='text-gray-700'>
Be notified when the{' '}
<Link href={'/course/'}>online course</Link> is
available or updated
</small>
</div>
<div className='col-auto'>
<div className='form-check form-switch'>
<input
className='form-check-input'
type='checkbox'
id='coursePreview'
{...registerFormField('coursePreview')}
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 875fc02

Please sign in to comment.