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

Joni/feature/96-add-cms-for-members-page #101

Merged
merged 75 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
fc984b4
- Enhanced component documentation for better clarity and developer g…
Jonroi Sep 15, 2024
c17d5a7
- Defined the TeamMember interface to structure the data model for te…
Jonroi Sep 15, 2024
cf83466
adjusting changed headers
Jonroi Sep 15, 2024
ed2c5ca
- Added fetch functionality to retrieve team member data from the bac…
Jonroi Sep 15, 2024
4301449
add more content for members to show
Jonroi Sep 18, 2024
5e968b1
Conditionally render clickable sections based on available backend data
Jonroi Sep 18, 2024
f0b6df7
Disable text selection and cursor visibility
Jonroi Sep 18, 2024
e122e12
documentation
Jonroi Sep 19, 2024
76f995c
- Added TaskText as a separate element below the member's name and ic…
Jonroi Sep 19, 2024
502a959
- Added bottom border to TaskText for separation.
Jonroi Sep 19, 2024
7346c43
add different colours for sections
Jonroi Sep 22, 2024
613c10a
Add envHelper for strapi
Jonroi Sep 23, 2024
f349b3c
Add Translate for playButton
Jonroi Sep 23, 2024
ffcb6fc
- Add reverse order display for groups (works better with strapi mana…
Jonroi Sep 24, 2024
4a35487
add envHelper for strapiHost
Jonroi Sep 24, 2024
3283508
Add data structure mapping (not just any)
Jonroi Sep 24, 2024
aa470ea
Add logo
Jonroi Sep 24, 2024
8e759b4
Adjust logo position and size
Jonroi Sep 24, 2024
571e2b2
Redesign Role looking like alt logo
Jonroi Sep 24, 2024
6f6404b
Add Part (first title) from strapi
Jonroi Sep 24, 2024
b78324c
Add Part from strapi
Jonroi Sep 24, 2024
a73b74c
make part and role as nude as possible
Jonroi Sep 24, 2024
127ecf0
starting point
Jonroi Sep 27, 2024
e3511a6
add more attributes for member
Jonroi Sep 27, 2024
dbd3f66
add instagram and facebook icons for member
Jonroi Sep 27, 2024
69c0554
add localization
Jonroi Sep 27, 2024
9ea9e19
delete unused css styling
Jonroi Sep 27, 2024
662a7e3
add height and widht to logo
Jonroi Sep 27, 2024
68e8123
fix translate routing
Jonroi Sep 27, 2024
b9402eb
fix translation
Jonroi Sep 27, 2024
cc7be3a
fixing rendering problem
Jonroi Sep 27, 2024
fdfa288
fix member location
Jonroi Sep 27, 2024
b4e3a8b
Fix incorrect rendering of members by ensuring proper assignment to d…
Jonroi Sep 28, 2024
349538f
refactor typing solution
Jonroi Sep 28, 2024
f938ff0
refactor api mapping and fetching functions
Jonroi Sep 28, 2024
b90d722
refaactor memberItem and departmentItem for own files
Jonroi Sep 28, 2024
2eb04b1
Updated API call to include Logo for both department and team section…
Jonroi Sep 28, 2024
7c22310
refactor move logo into icon container
Jonroi Sep 28, 2024
14e19eb
refactor: clean up and add detailed documentation for Strapi mapping,…
Jonroi Sep 28, 2024
6582c1b
add styling for membersSection
Jonroi Sep 28, 2024
443ccfc
Rename logowrapper and adjust measurements
Jonroi Sep 30, 2024
558a14d
Add new styling for team page
Jonroi Sep 30, 2024
3865aa6
Add alphabetic arrange for members
Jonroi Oct 1, 2024
6270996
Add sorting for departments
Jonroi Oct 1, 2024
ce667e0
department section documentation
Jonroi Oct 1, 2024
2bddc5d
Remove unnecessery comments
Jonroi Oct 3, 2024
dd73298
refactor types file to entities
Jonroi Oct 3, 2024
bb6d2ab
Refactor mapping
Jonroi Oct 3, 2024
b5f04e5
Correct types import
Jonroi Oct 3, 2024
2c16cc2
correct types import
Jonroi Oct 3, 2024
2c5cfcf
Refactor memberItem to use nextLink
Jonroi Oct 3, 2024
b8e2aa4
relocate mappers
Jonroi Oct 3, 2024
7de7ce8
Relocate api,memberItem and DepartmentItem
Jonroi Oct 3, 2024
5cee26b
Relocate department and member item
Jonroi Oct 3, 2024
e7e3c50
clean usnecessery comments
Jonroi Oct 3, 2024
5b52c5b
Clean comments & refactor css properties for member and department mo…
Jonroi Oct 3, 2024
cc14887
Merge remote-tracking branch 'origin/dev' into joni/feature/96-add-cm…
leolabdev Oct 4, 2024
729611c
Remove unnecessary language parameter
leolabdev Oct 4, 2024
e3b958d
add links for member module
Jonroi Oct 4, 2024
2bc752d
add better naming for member functions
Jonroi Oct 4, 2024
35e2d90
refactor membersApi as redux
Jonroi Oct 4, 2024
b830a1d
fix correct import and usage of useGetTeamsQuery hook from membersApi
Jonroi Oct 5, 2024
9928b31
delete comments
Jonroi Oct 5, 2024
83dacc8
add teamApi for stateSchema
Jonroi Oct 5, 2024
ba1c0d5
refactor: update function names for clarity and remove 'map' references
Jonroi Oct 5, 2024
bd638be
fix correct path via envHelper
Jonroi Oct 5, 2024
0c77243
Refactor import paths in membersApi.ts
leolabdev Oct 7, 2024
abba6d7
Fix relative import path in Member mappers module
leolabdev Oct 7, 2024
32bc12a
Refactor import paths for Member and Department types
leolabdev Oct 7, 2024
900d96d
Refactor member link type handling
leolabdev Oct 7, 2024
15a20cf
Add Strapi API integration
leolabdev Oct 7, 2024
027725f
Refactor teamApi to use strapiApi for endpoint injection
leolabdev Oct 7, 2024
7a6e640
Add useGetTeamsQuery export to Member entity
leolabdev Oct 7, 2024
7247955
Refactor imports in SectionMembers.tsx
leolabdev Oct 7, 2024
ac51dbf
Add Strapi environment variables to CI workflow
leolabdev Oct 7, 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
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
NEXT_PUBLIC_API_LINK: ${{ secrets.NEXT_PUBLIC_API_LINK }}
NEXT_PUBLIC_API_DOMAIN: ${{ secrets.NEXT_PUBLIC_API_DOMAIN }}
NEXT_PUBLIC_LOCAL_HOST: ${{ secrets.NEXT_PUBLIC_LOCAL_HOST }}
NEXT_PUBLIC_STRAPI_API_URL: ${{ secrets.NEXT_PUBLIC_STRAPI_API_URL }}
NEXT_PUBLIC_STRAPI_HOST: ${{ secrets.NEXT_PUBLIC_STRAPI_HOST }}


- name: Run tests
run: npm test
Expand All @@ -44,6 +47,8 @@ jobs:
NEXT_PUBLIC_API_LINK: ${{ secrets.NEXT_PUBLIC_API_LINK }}
NEXT_PUBLIC_API_DOMAIN: ${{ secrets.NEXT_PUBLIC_API_DOMAIN }}
NEXT_PUBLIC_LOCAL_HOST: ${{ secrets.NEXT_PUBLIC_LOCAL_HOST }}
NEXT_PUBLIC_STRAPI_API_URL: ${{ secrets.NEXT_PUBLIC_STRAPI_API_URL }}
NEXT_PUBLIC_STRAPI_HOST: ${{ secrets.NEXT_PUBLIC_STRAPI_HOST }}

# - name: Run Cypress tests
# run: npm run cypress:run
Expand Down
46 changes: 23 additions & 23 deletions frontend-next-migration/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,31 @@
// withBundleAnalyzer,
// ], nextConfig);


// module.exports = nextConfig;
const path = require('path');
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
remotePatterns: [
{ hostname: process.env.NEXT_PUBLIC_API_DOMAIN },
{ hostname: 'hips.hearstapps.com' },
{ hostname: 'www.thesprucepets.com' },
{ hostname: 'heroes.ts.unsplash.com' },
{ hostname: 'raw.githubusercontent.com' },
{ hostname: 'localhost' }, // Add localhost for development
{ hostname: new URL(process.env.NEXT_PUBLIC_STRAPI_HOST).hostname },
],
},
sassOptions: {
includePaths: [path.join(__dirname, 'styles')],
// prependData: `@import "src/app/styles/variables/_mixins.scss";`,
prependData: `@import "src/app/_styles/variables/_mixins.scss";`,
// prependData: `@import "src/preparedApp/styles/variables/_mixins.scss";`,
},
output: 'standalone',
// experimental: {
// webpackBuildWorker: true
// },
};

images: {
remotePatterns: [
{ hostname: process.env.NEXT_PUBLIC_API_DOMAIN },
{ hostname: "hips.hearstapps.com" },
{ hostname: "www.thesprucepets.com" },
{ hostname: "heroes.ts.unsplash.com" },
{ hostname: "raw.githubusercontent.com" },
],
},
sassOptions: {
includePaths: [path.join(__dirname, 'styles')],
// prependData: `@import "src/app/styles/variables/_mixins.scss";`,
prependData: `@import "src/app/_styles/variables/_mixins.scss";`,
// prependData: `@import "src/preparedApp/styles/variables/_mixins.scss";`,
},
output: 'standalone',
// experimental: {
// webpackBuildWorker: true
// },
}

module.exports = nextConfig
module.exports = nextConfig;
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {AuthUserSchema} from "@/entities/Auth";
import {gameApi} from "@/shared/api";
import { AuthUserSchema } from '@/entities/Auth';
import {gameApi, strapiApi} from '@/shared/api';

export interface StateSchema {
authUser: AuthUserSchema;
[gameApi.reducerPath]: ReturnType<typeof gameApi.reducer>;
// todo add here strapiApi
authUser: AuthUserSchema;
[gameApi.reducerPath]: ReturnType<typeof gameApi.reducer>;
[strapiApi.reducerPath]: ReturnType<typeof strapiApi.reducer>;
}

Original file line number Diff line number Diff line change
@@ -1,79 +1,78 @@
import {combineReducers, configureStore} from "@reduxjs/toolkit";
import { persistStore, persistReducer } from 'redux-persist'
import { combineReducers, configureStore } from '@reduxjs/toolkit';
import { persistStore, persistReducer } from 'redux-persist';
import createWebStorage from 'redux-persist/lib/storage/createWebStorage';
import {envHelper} from "@/shared/const/envHelper";
import {StateSchema} from "./StateSchema";
import {authUserReducer, authMiddleware} from "@/entities/Auth";
import {FLUSH, PAUSE, PERSIST, PURGE, REGISTER, REHYDRATE} from "redux-persist";
import {setupListeners} from "@reduxjs/toolkit/query";
import {gameApi} from "@/shared/api";


const createNoopStorage= () => {
return {
getItem(_key: any){
return Promise.resolve(null)
},
setItem(_key: any, value: any){
return Promise.resolve(value)
},
removeItem(_key: any){
return Promise.resolve()
}

}
}
import { envHelper } from '@/shared/const/envHelper';
import { StateSchema } from './StateSchema';
import { authUserReducer, authMiddleware } from '@/entities/Auth';
import {
FLUSH,
PAUSE,
PERSIST,
PURGE,
REGISTER,
REHYDRATE,
} from 'redux-persist';
import { setupListeners } from '@reduxjs/toolkit/query';
import {gameApi, strapiApi} from '@/shared/api';

const createNoopStorage = () => {
return {
getItem(_key: any) {
return Promise.resolve(null);
},
setItem(_key: any, value: any) {
return Promise.resolve(value);
},
removeItem(_key: any) {
return Promise.resolve();
},
};
};

const storage =
typeof window !== "undefined"
? createWebStorage("local")
: createNoopStorage();

typeof window !== 'undefined'
? createWebStorage('local')
: createNoopStorage();

export function createReduxStore(initialState?: StateSchema) {
const rootReducer = combineReducers({
authUser: authUserReducer,
[gameApi.reducerPath]: gameApi.reducer,
[strapiApi.reducerPath]: strapiApi.reducer,
});

const persistConfig = {
key: 'root',
storage,
blacklist: [
gameApi.reducerPath,
strapiApi.reducerPath
],
};

const persistedReducer = persistReducer(persistConfig, rootReducer);

const store = configureStore({
// reducer: rootReducer,
reducer: persistedReducer,
//only in dev mode
devTools: envHelper.isDevMode,
preloadedState: initialState,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: {
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
},
}).concat(
gameApi.middleware,
strapiApi.middleware,
authMiddleware
),
});

const rootReducer = combineReducers({
authUser: authUserReducer,
[gameApi.reducerPath]: gameApi.reducer,
// todo add here strapiApi
});

const persistConfig = {
key: 'root',
storage,
// todo add here strapiApi
blacklist: [gameApi.reducerPath]
};


const persistedReducer = persistReducer(persistConfig, rootReducer);


const store = configureStore({
// reducer: rootReducer,
reducer: persistedReducer,
//only in dev mode
devTools: envHelper.isDevMode,

preloadedState: initialState,

middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: {
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
},
}).concat(
gameApi.middleware,
authMiddleware,
),

});

const persistor = persistStore(store);

setupListeners(store.dispatch);
const persistor = persistStore(store);

return { store, persistor };
setupListeners(store.dispatch);

return { store, persistor };
}

1 change: 1 addition & 0 deletions frontend-next-migration/src/entities/Member/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useGetTeamsQuery } from './membersApi';
113 changes: 113 additions & 0 deletions frontend-next-migration/src/entities/Member/api/mappers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { Member, Department } from '../model/types/types';
import { faGlobe, faEnvelope } from '@fortawesome/free-solid-svg-icons';
import { envHelper } from '@/shared/const/envHelper';
import {
faGithub,
faLinkedin,
faInstagram,
faFacebook,
} from '@fortawesome/free-brands-svg-icons';

/**
* LinksMap provides a mapping of link types to FontAwesome icons.
*/
export const getLinks = () => ({
website: faGlobe,
github: faGithub,
linkedin: faLinkedin,
facebook: faFacebook,
instagram: faInstagram,
email: faEnvelope,
});

/**
* Maps raw member data from the API response to the Member type used in the application.
* Sorts members alphabetically by name.
* @param membersData An array of raw member data from the API.
* @returns An array of members mapped to the Member type.
*/
export const getMembers = (membersData: any[]): Member[] => {
return (
membersData
.map((member: any) => {
const logoUrl = member.attributes.Logo?.data?.attributes?.url
? `${envHelper.strapiHost}${member.attributes.Logo.data.attributes.url}`
: null;

return {
id: member.id,
name: member.attributes.Name,
task: member.attributes.Task,
email: member.attributes.Email,
linkedin: member.attributes.Linkedin,
website: member.attributes.Website,
github: member.attributes.Github,
logo: logoUrl,
facebook: member.attributes.Facebook,
instagram: member.attributes.Instagram,
createdAt: member.attributes.createdAt,
updatedAt: member.attributes.updatedAt,
locale: member.attributes.locale,
};
})
.sort((a, b) => a.name.localeCompare(b.name)) || []
);
};

/**
* Maps raw department data from the API response to the Department type used in the application.
* Sorts departments based on a predefined order depending on the locale.
* @param departmentsData An array of raw department data from the API.
* @param locale The language locale used to find the localized department name.
* @returns An array of departments mapped to the Department type.
*/
export const getDepartments = (
departmentsData: any[],
locale: string,
): Department[] => {
const orderEn = [
'Lead Developers',
'Game Developer',
'Website Developer',
'Developers',
'Graphics',
'Graphical Game Development',
'Sound Design & Composition',
'Sound Design-Oriented Game Development',
];

const orderFi = [
'Vastaava Ohjelmistokehittäjä',
'Pelikehittäjä',
'Verkkosivukehittäjä',
'Ohjelmistokehittäjät',
'Grafiikka',
'Graafinen pelikehitys',
'Äänisuunnittelu ja Sävellys',
'Äänisuunnittelullinen Pelikehitys',
];

const order = locale === 'fi' ? orderFi : orderEn;

return (
departmentsData
.map((dept: any) => {
const localizedDept = dept.attributes.localizations?.data.find(
(loc: any) => loc.attributes.locale === locale,
);

const localizedDeptName = localizedDept
? localizedDept.attributes.Name
: dept.attributes.Name;

const members = getMembers(dept.attributes.members?.data || []);

return {
id: dept.id,
name: localizedDeptName,
members,
};
})
.sort((a, b) => order.indexOf(a.name) - order.indexOf(b.name)) || []
);
};
Loading