Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/word-wrap-1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
faouziMohamed authored Nov 15, 2023
2 parents bb1afe6 + ce79339 commit c338313
Show file tree
Hide file tree
Showing 138 changed files with 8,427 additions and 3,093 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ module.exports = {
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'next/core-web-vitals',
// 'plugin:unicorn/recommended',
'plugin:promise/recommended',
'plugin:prettier/recommended',
'prettier',
],
rules: {
// 'no-unused-vars': 'off',
'no-console': 'warn',
'no-alert': 'error',
'no-empty': 'error',
Expand All @@ -48,7 +47,7 @@ module.exports = {
message:
"Don't use Chakra's <Heading/> component. It creates an inconsistent UI with different heading sizes. Use <Text as='h1'/> instead.",
selector:
'ImportDeclaration[source.value="@chakra-ui/react"] > ImportSpecifier[imported.name="Heading"]',
'ImportDeclaration[source.value="@chakra-ui/react"] > ImportSpecifier[imported.fullName="Heading"]',
},
],
'prettier/prettier': [
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/main_code-amci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy JAR app to Azure Web App - code-amci

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Java version
uses: actions/setup-java@v1
with:
java-version: '17'

- name: Build with Maven
run: mvn clean install

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: java-app
path: '${{ github.workspace }}/target/*.jar'

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: java-app

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'code-amci'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_0C382FA8CE954EE7AC2BD3F73E122D05 }}
package: '*.jar'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ next-env.d.ts
# next.js
/.next/
/out/
.env
.env.local
# production
/build

Expand Down Expand Up @@ -56,3 +56,4 @@ sitemap.xml
/git-filter-repo
/.idea/dataSources/

/.env
23 changes: 0 additions & 23 deletions .idea/dataSources.local.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/dataSources.xml

This file was deleted.

19 changes: 19 additions & 0 deletions .idea/highlightedFiles.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ nginx
# misc
# debug
# local env files
.env
.env.local
# vercel
.vercel

31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.0.0](https://github.com/faouziMohamed/amci-scholarship/compare/v0.1.1...v1.0.0) (2023-11-14)

### Bug Fixes

- add websocket true url ([c6447c9](https://github.com/faouziMohamed/amci-scholarship/commit/c6447c9ee7f8f538c056406c6798e5755c77e94e))
- deploy to Vercel ([d0273b0](https://github.com/faouziMohamed/amci-scholarship/commit/d0273b0fe2942b313406f06beca3566c172155c7))
- update packages and fix dashboard error on prod build ([a3be5d9](https://github.com/faouziMohamed/amci-scholarship/commit/a3be5d9f7d0429f8eadcf5c2c7409a0714cd2693))

### 0.1.1 (2023-11-14)

### Features

- add auto generation id of the sidebar's list item ([c9fed9f](https://github.com/faouziMohamed/amci-scholarship/commit/c9fed9fdbd83d257983a1e8de8dd078bf3a6f892))
- add dashboard page ([6404c69](https://github.com/faouziMohamed/amci-scholarship/commit/6404c697cf7018f89b8f08bd0ca1e281e9776806))
- add query filter and part of the frontend ([f87c7e2](https://github.com/faouziMohamed/amci-scholarship/commit/f87c7e248d997880f539581978b3a33721d0f5bf))
- add users page and some notice all over the app ([c103e90](https://github.com/faouziMohamed/amci-scholarship/commit/c103e9041ac5919bf73046901a8193ef4592b80f))
- allow admin to add new codes ([292f53d](https://github.com/faouziMohamed/amci-scholarship/commit/292f53d7c61f1dd8349299376a5ba581b85b2c0d))
- **cache:** cache already fetched data on the client to avoid hitting the api each time ([cb7d4b2](https://github.com/faouziMohamed/amci-scholarship/commit/cb7d4b2edbbdd9e2dd9ce98fae26d8cabb146570))
- **csv, db schema:** update csv file format, the database and typescript accordingly ([df4f7d9](https://github.com/faouziMohamed/amci-scholarship/commit/df4f7d91e12e22826e1b1fc393a285156608346c))
- fix regex allowing to type matricule or name ([b288a55](https://github.com/faouziMohamed/amci-scholarship/commit/b288a555d716b7cc6a903da7a01c82c3eafe7526))
- integrate new backend and add user space and admin page ([31b1ca9](https://github.com/faouziMohamed/amci-scholarship/commit/31b1ca9eea9c520b3898ca73d3a45ec59aa0eb82))
- remove breadcrumbs and add scroll on the sidebar ([c22a090](https://github.com/faouziMohamed/amci-scholarship/commit/c22a090dbb9c4474dfe341d86bda972f238feb49))
- remove page directory and migrate to the new app directory ([ce10984](https://github.com/faouziMohamed/amci-scholarship/commit/ce109846a3e20a502145e95dfdeeeea120b477ec))
- remove prisma and update next config ([b1a5788](https://github.com/faouziMohamed/amci-scholarship/commit/b1a57885426214403b1effc78612dbffdb82d5cc))
- **seo:** add seo tags ([c0996e7](https://github.com/faouziMohamed/amci-scholarship/commit/c0996e7f485446880ee3772950b4738af4bfb680))
- **seo:** add seo tags ([fa20a97](https://github.com/faouziMohamed/amci-scholarship/commit/fa20a978cece13abace990702d90e1027e6ae870))
- **view mode:** add view mode of results (list& grid) ([e8d8a2e](https://github.com/faouziMohamed/amci-scholarship/commit/e8d8a2e42266bc9285220f2e9c11a4031386e9ce))
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ This project show in a convenient way the scholarships code used that students w

## Getting Started

In this project i'm using yarn as package manager. Make sure if you contribute to this project to use yarn instead of npm.
In this project i'm using yarn as package manager. Make sure if you contribute to this project to use yarn instead of
npm.
This project is built using:

- [Next.js](https://nextjs.org/) (React) for the frontend and serverless functions
Expand All @@ -32,9 +33,11 @@ NEXT_PUBLIC_SITE_URL=http://localhost:3000 # or your production url eg: https://

### Create the database

> You can have a ready to use database using Planetscale. You can create a free account [here](https://planetscale.com/) and then copy the database url from the database page.
> You can have a ready to use database using Planetscale. You can create a free account [here](https://planetscale.com/)
> and then copy the database url from the database page.
- If you are using Planetscale, make sure to select the connection for prisma. Otherwise, running the migration may fail.
- If you are using Planetscale, make sure to select the connection for prisma. Otherwise, running the migration may
fail.

Run the following command to create the database:

Expand All @@ -53,17 +56,19 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the

### Add data to the database

The to use to init the database must be stored on the path [`src/Repository/data/code_amci.csv`](src/Repository/data/code_amci.csv) and it's mandatory to be in csv format with the following 5 columns and no header should be present:
The to use to init the database must be stored on the
path [`src/Repository/data/code_amci.csv`](src/Repository/data/code_amci.csv) and it's mandatory to be in csv format
with the following 5 columns and no header should be present:

| country | matricule | name | passport_name | periode_code | scholarship_code |
| ----------------- | --------- | ------------------------------ | ----------------- | ------------ | ---------------- |
| Union des Comores | 20161136 | MOHAMED FAOUZI FAOUZOUDINE | true passport num | 81680 | 1113569 |
| Union des Comores | 20161141 | HOUZAIMATA IBRAHIM | true passport num | 81680 | 1113570 |
| Union des Comores | 20170952 | MOHAMED NASROUDINE SOULAIMANA | true passport num | 81680 | 1113612 |
| Union des Comores | 20170955 | BEN HALIDI IGRAH SOYABA | true passport num | 81680 | 1113613 |
| Union des Comores | 20170967 | HARIBOU ABDOUL KADER ATTOUMANI | true passport num | 81680 | 1113614 |
| Union des Comores | 20171029 | SEIFILMOULOUK SAID | true passport num | 81680 | 1113618 |
| ... | ... | ... | true passport num | ... | ... |
| country | matricule | fullName | passport_name | periode_code | scholarship_code |
| ----------------- | --------- | ------------------------------ | ----------------------- | ------------ | ---------------- |
| Union des Comores | 20161136 | MOHAMED FAOUZI FAOUZOUDINE | true passportNumber num | 81680 | 1113569 |
| Union des Comores | 20161141 | HOUZAIMATA IBRAHIM | true passportNumber num | 81680 | 1113570 |
| Union des Comores | 20170952 | MOHAMED NASROUDINE SOULAIMANA | true passportNumber num | 81680 | 1113612 |
| Union des Comores | 20170955 | BEN HALIDI IGRAH SOYABA | true passportNumber num | 81680 | 1113613 |
| Union des Comores | 20170967 | HARIBOU ABDOUL KADER ATTOUMANI | true passportNumber num | 81680 | 1113614 |
| Union des Comores | 20171029 | SEIFILMOULOUK SAID | true passportNumber num | 81680 | 1113618 |
| ... | ... | ... | true passportNumber num | ... | ... |

In your browser or http client (Insomnia, Postman, Thunder Client, etc), make a GET request to the following url:

Expand All @@ -73,4 +78,3 @@ In your browser or http client (Insomnia, Postman, Thunder Client, etc), make a
This will add the data to the database. You can start using the app.

Hooray 🎉🎉🎉

63 changes: 48 additions & 15 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,53 +20,86 @@ const nextConfig = {
eslint: {
dirs: ['src'],
},

optimizeFonts: true,
compiler: {
styledComponents: { ssr: true, displayName: true },
},
experimental: {
appDir: true,
// chakra ui
transpilePackages: ['@chakra-ui/react', '@chakra-ui/icons', 'react-icons'],
images: {
domains: ['avatars.githubusercontent.com'],
},

async headers() {
return [
{
source: '/(.*)',
headers: [
...createSecureHeaders(),
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin',
},
],
},
];
},
output: 'standalone',
output: process.env.BUILD_STANDALONE === 'true' ? 'standalone' : undefined,
poweredByHeader: false,
publicRuntimeConfig: { lastBuild, lastBuildIso },
reactStrictMode: true,

// https://github.com/vercel/next.js/issues/48177#issuecomment-1557354538
// SVGR
webpack(config) {
webpack(config, { isServer }) {
// Configures webpack to handle SVG files with SVGR. SVGR optimizes and transforms SVG files
// into React components. See https://react-svgr.com/docs/next/

// Grab the existing rule that handles SVG imports
// @ts-ignore - rules is a private property that is not typed
const fileLoaderRule = config.module.rules.find((rule) =>
rule.test?.test?.('.svg'),
);

config.module.rules.push(
// Reapply the existing rule, but only for svg imports ending in ?url
{
...fileLoaderRule,
test: /\.svg$/i,
type: 'asset',
resourceQuery: /url/, // *.svg?url
},
// Convert all other *.svg imports to React components
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
resourceQuery: { not: [/url/] }, // exclude react component if *.svg?url
use: [
{
loader: '@svgr/webpack',
options: { typescript: true, icon: true },
},
],
issuer: fileLoaderRule.issuer,
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
use: ['@svgr/webpack'],
},
);

// Modify the file loader rule to ignore *.svg, since we have it handled now.
fileLoaderRule.exclude = /\.svg$/i;

return config;
},
};
Expand Down
Loading

0 comments on commit c338313

Please sign in to comment.