Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devrel 1236/create jumpstart app #1

Merged
merged 56 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c834f9c
add colors and fonts to tailwind theme
IvanKiral Nov 5, 2024
8c72f9f
Add header and container components
IvanKiral Nov 5, 2024
5d87c97
Add HeroImage component
IvanKiral Nov 5, 2024
0e0afc3
add video component
IvanKiral Nov 6, 2024
801d509
add featured article and event
IvanKiral Nov 6, 2024
b03fccf
remove padding from container
IvanKiral Nov 6, 2024
bb33beb
extract logo an navigation into components
IvanKiral Nov 6, 2024
5263763
add footer
IvanKiral Nov 6, 2024
1a74b3c
Refactoring and responsive design
IvanKiral Nov 7, 2024
1c59d2f
add delivery sdk and add options to for formatting
IvanKiral Nov 7, 2024
8b449a9
add generated model from environment
IvanKiral Nov 7, 2024
b7fc592
update app to use data from kontent.ai
IvanKiral Nov 7, 2024
ef1a1c8
fix typography
IvanKiral Nov 11, 2024
0f2c067
use rich text resolver for rich text elements
IvanKiral Nov 11, 2024
ce95b06
make adding content interactive interactive
IvanKiral Nov 11, 2024
e12f45d
fixup navigation keys
IvanKiral Nov 11, 2024
e0614f3
regenarete model and update video component
IvanKiral Nov 11, 2024
8954d85
fix component rendering when partial content
IvanKiral Nov 11, 2024
5f118bd
update index html title
IvanKiral Nov 11, 2024
993a0d8
fixup page content space
IvanKiral Nov 11, 2024
0431f19
remove unnecesray log
IvanKiral Nov 11, 2024
aa6fadf
update model
IvanKiral Nov 11, 2024
9e1975d
Fix video autoplay
IvanKiral Nov 11, 2024
8e6a3ce
Fix video iframe when non-existing link
IvanKiral Nov 12, 2024
4c86de9
add react router
IvanKiral Nov 12, 2024
e0e17bb
add context for environment parameters
IvanKiral Nov 12, 2024
7831e93
use simple router to get to the page
IvanKiral Nov 12, 2024
cc8a0e8
add auth0 dependencies
IvanKiral Nov 12, 2024
d4ad528
implement change environmentId
IvanKiral Nov 12, 2024
3f0b266
add vercel.json
IvanKiral Nov 12, 2024
d61b543
update filtering of items
IvanKiral Nov 13, 2024
cfac2ef
regenerate model to change event's asset to image
IvanKiral Nov 13, 2024
669b8f0
fix pageContent alignment
IvanKiral Nov 13, 2024
437b1e2
make app more robust for content type element's mistakes
IvanKiral Nov 13, 2024
cd5ff0d
fixup return filtering for landing_page
IvanKiral Nov 13, 2024
11075db
fix tag coloring
IvanKiral Nov 13, 2024
afa37b3
add space in landing page body_copy
IvanKiral Nov 13, 2024
ceae304
add images alt
IvanKiral Nov 13, 2024
61e5ec0
add title for iframe
IvanKiral Nov 13, 2024
26bff09
add meta description
IvanKiral Nov 13, 2024
0d5f521
redirect after popup login
IvanKiral Nov 19, 2024
655b197
use suspense for one continuous loader
IvanKiral Nov 19, 2024
c2a8c3c
update event color
IvanKiral Nov 19, 2024
7ac2df8
add robots.txt
IvanKiral Nov 19, 2024
f09ab86
add static sizes to images
IvanKiral Nov 19, 2024
2c37319
update richtext style for other elments
IvanKiral Nov 19, 2024
1d74475
update readme and env template
IvanKiral Nov 20, 2024
f236739
add lint and build github workflow
IvanKiral Nov 20, 2024
acc6e32
temporalily use default eslint
IvanKiral Nov 22, 2024
5c76a92
update link to data-ops in readme
IvanKiral Nov 22, 2024
a2e4ee0
add robustness with messages when type is missing element
IvanKiral Nov 22, 2024
f39179f
change images to use webp format
IvanKiral Nov 22, 2024
98d481f
update body_copy to be in page section
IvanKiral Dec 3, 2024
020ee6c
update landing page item filter option
IvanKiral Dec 3, 2024
affb158
change jumpstart to kickstart
IvanKiral Dec 4, 2024
fd62436
fix environment variable name
IvanKiral Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
VITE_ENVIRONMENT_ID=
VITE_DELIVERY_API_KEY=

# (Optional) used only for model generation
VITE_MAPI_API_KEY=

# Only for Kontent.ai developers
VITE_AUTH_REDIRECT_URL=
VITE_AUTH_DOMAIN=
VITE_AUTH_CLIENT_ID=
VITE_KONTENT_URL=
VITE_DELIVER_URL=
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint & Build

on:
push:
branches: [main]
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
id: nvm
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run lint
- run: npm run build

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

.env
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/*
117 changes: 67 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,67 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
```
# Kontent.ai Kickstart Sample React App

[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![Discord][discord-shield]][discord-url]

This repository contains the solution for the Kontent.ai Kickstart Sample React App. It serves as a learning resource for those starting new projects with Kontent.ai, providing a foundational template to build upon.

The app is built with Vite for fast and optimized development, and Tailwind CSS is used for styling the application.

## Contributing

### How to Contribute

- **Report Issues**: Use the [GitHub Issues](https://github.com/kontent-ai/kickstart-react-app/issues) to report bugs or request features.
- **Fork the Repository**: Create a personal fork of the repository on GitHub.
- **Create a Feature Branch**: Use a descriptive name for your branch.
- **Submit a Pull Request**: Submit your changes for review.

Please read our [Contributing Guidelines](CONTRIBUTING.md) for more details.

### Code of Conduct

This project adheres to a [Code of Conduct](https://github.com/kontent-ai/.github/blob/main/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.

### Getting Started with Development

- Run `npm ci` to install packages.
- Create a `.env` file from `.env.template` and fill out all necessary variables.
- Run `npm run dev` to run the application in developer mode.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details.

---

## Support

If you have any questions or need assistance, please reach out:

- **Kontent.ai Support**: [Contact Support](https://kontent.ai/support/)

---

## Additional Resources

- **Kontent.ai Official Documentation**: [Learn more about Kontent.ai](https://kontent.ai/learn/)

---

[contributors-shield]: https://img.shields.io/github/contributors/kontent-ai/kickstart-react-app?style=for-the-badge
[contributors-url]: https://github.com/kontent-ai/kickstart-react-app/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/kontent-ai/kickstart-react-app.svg?style=for-the-badge
[forks-url]: https://github.com/kontent-ai/kickstart-react-app/network/members
[stars-shield]: https://img.shields.io/github/stars/kontent-ai/kickstart-react-app.svg?style=for-the-badge
[stars-url]: https://github.com/kontent-ai/kickstart-react-app/stargazers
[issues-shield]: https://img.shields.io/github/issues/kontent-ai/kickstart-react-app.svg?style=for-the-badge
[issues-url]: https://github.com/kontent-ai/kickstart-react-app/issues
[license-shield]: https://img.shields.io/github/license/kontent-ai/kickstart-react-app.svg?style=for-the-badge
[license-url]: https://github.com/kontent-ai/kickstart-react-app/blob/master/LICENSE.md
[discord-shield]: https://img.shields.io/discord/821885171984891914?color=%237289DA&label=Kontent.ai%20Discord&logo=discord&style=for-the-badge
[discord-url]: https://discord.com/invite/SKCxwPtevJ

13 changes: 11 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@ import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import react from 'eslint-plugin-react';

export default tseslint.config(
js.configs.recommended,
tseslint.configs.recommended,
{ ignores: ['dist'] },
{
extends: ["@kontent-ai"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we not using it anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its in old version, need to be updated :/ had more problem to configure it than using so i decided to remove it for now

files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
ecmaVersion: "latest",
sourceType: "module",
globals: globals.browser,
parserOptions: {
ecmaFeatures: {
jsx: true
}
}
},
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
Expand Down
30 changes: 30 additions & 0 deletions generateModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import dotenv from 'dotenv';
import {generateDeliveryModelsAsync} from "@kontent-ai/model-generator";


dotenv.config();

const {VITE_ENVIRONMENT_ID, VITE_MAPI_API_KEY} = process.env;

if(!VITE_ENVIRONMENT_ID){
throw new Error("VITE_ENVIRONMENT_ID cannot be empty!");
}

if(!VITE_MAPI_API_KEY){
throw new Error("VITE_MAPI_API_KEY cannot be empty!");
}

await generateDeliveryModelsAsync(
{
environmentId: VITE_ENVIRONMENT_ID,
apiKey: VITE_MAPI_API_KEY,
addTimestamp: false,
outputDir: "./src/model",
moduleFileExtension: "ts",
fileResolvers: {
taxonomy: "camelCase",
contentType: "camelCase",
snippet: "camelCase"
}
}
);
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<meta name="description" content="Get started quickly with Kontent.ai using our Kickstart application template." />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Abhaya+Libre:wght@400;500;600;700;800&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap" rel="stylesheet">
<title>Kontent.ai Kickstart</title>
</head>
<body>
<div id="root"></div>
Expand Down
Loading
Loading