Skip to content

Commit

Permalink
Merge branch 'release/1.0.2' into feature/issue-1529
Browse files Browse the repository at this point in the history
  • Loading branch information
sashapanasiuk5 authored Sep 14, 2024
2 parents c9ac6b1 + 219f294 commit 7836685
Show file tree
Hide file tree
Showing 21 changed files with 315 additions and 113 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ REACT_APP_BACKEND_URL=https://localhost:5001/api
REACT_APP_TEMPVAL=tempval
API_URL=https://best.api.ever.com
REACT_APP_GOOGLE_ANALYTICS=tempval
RECAPTCHA_SITE_KEY="6LeUO3ApAAAAAOC7F4v0qTsSwIR9mZu33SWjAAtM"
RECAPTCHA_SITE_KEY="6LeUO3ApAAAAAOC7F4v0qTsSwIR9mZu33SWjAAtM"
VERSION=1.0.0
35 changes: 35 additions & 0 deletions GITVERSION_PROPERTIES
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"Major": 1,
"Minor": 0,
"Patch": 0,
"PreReleaseTag": "beta.1",
"PreReleaseTagWithDash": "-beta.1",
"PreReleaseLabel": "beta",
"PreReleaseLabelWithDash": "-beta",
"PreReleaseNumber": 1,
"WeightedPreReleaseNumber": 30001,
"BuildMetaData": 47,
"BuildMetaDataPadded": "0047",
"FullBuildMetaData": "47.Branch.release-1.0.0.Sha.283d01e8424001490c227db838d965580c59935e",
"MajorMinorPatch": "1.0.0",
"SemVer": "1.0.0-beta.1",
"LegacySemVer": "1.0.0-beta1",
"LegacySemVerPadded": "1.0.0-beta0001",
"AssemblySemVer": "1.0.0.0",
"AssemblySemFileVer": "1.0.0.0",
"FullSemVer": "1.0.0-beta.1+47",
"InformationalVersion": "1.0.0-beta.1+47.Branch.release-1.0.0.Sha.283d01e8424001490c227db838d965580c59935e",
"BranchName": "release/1.0.0",
"EscapedBranchName": "release-1-0-0",
"Sha": "283d01e8424001490c227db838d965580c59935e",
"ShortSha": "283d01e",
"NuGetVersionV2": "1.0.0-beta0001",
"NuGetVersion": "1.0.0-beta0001",
"NuGetPreReleaseTagV2": "beta0001",
"NuGetPreReleaseTag": "beta0001",
"VersionSourceSha": "bd3aa573f4e0308049bbef8c6639abd2851495a0",
"CommitsSinceVersionSource": 47,
"CommitsSinceVersionSourcePadded": "0047",
"UncommittedChanges": 1,
"CommitDate": "2024-09-12"
}
12 changes: 7 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pipeline {
sh "cat version"
vers = readFile(file: 'version').trim()
sh "echo ${vers}"
env.vers="${vers}"
env.CODE_VERSION = readFile(file: 'version').trim()
echo "${env.CODE_VERSION}"
SEM_VERSION="${env.CODE_VERSION}"
Expand Down Expand Up @@ -234,14 +235,15 @@ pipeline {
}
steps {
script {

git branch: 'master', credentialsId: 'test_git_user', url: '[email protected]:ita-social-projects/StreetCode_Client.git'
sh 'echo ${BRANCH_NAME}'
sh "git checkout master"
sh 'echo ${BRANCH_NAME}'
sh "git merge release/${env.SEM_VERSION}"
sh "npm version ${env.SEM_VERSION} -m 'Upgrade to %s as part of release'"

sh "git push origin main"
sh 'git merge ${BRANCH_NAME}'
sh "npm version ${env.vers} --allow-same-version --no-git-tag-version"
sh "git add ."
sh "git commit -m 'Upgrade to %s as part of release'"
sh "git push origin master"

}
}
Expand Down
98 changes: 51 additions & 47 deletions config/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,53 +38,57 @@ module.exports = {
new Dotenv({
path: `./.env`,
}),
// new GenerateSW({
// skipWaiting: true,
// clientsClaim: true,
// maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
// runtimeCaching: [
// {
// urlPattern: /\.(?:js|css)$/,
// handler: 'CacheFirst',
// options: {
// cacheName: 'static-resources',
// expiration: {
// maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
// },
// },
// },
// {
// urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
// handler: 'CacheFirst',
// options: {
// cacheName: 'image-resources',
// expiration: {
// maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
// },
// },
// },
// {
// urlPattern: /\.(?:woff|woff2|ttf|otf)$/,
// handler:'CacheFirst',
// options: {
// cacheName: 'font-resources',
// expiration: {
// maxAgeSeconds: 60 * 60 * 24 * 90, // 3 months
// },
// },
// },
// {
// urlPattern: /^https?.*/,
// handler: 'NetworkFirst',
// options: {
// cacheName: 'external-resources',
// expiration: {
// maxEntries: 260
// },
// },
// },
// ],
// }),
new GenerateSW({
skipWaiting: true,
clientsClaim: true,
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
runtimeCaching: [
{
urlPattern: /env-config\.js$/,
handler: 'NetworkOnly'
},
{
urlPattern: /\.(?:js|css)$/,
handler: 'CacheFirst',
options: {
cacheName: 'static-resources',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
},
},
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
handler: 'CacheFirst',
options: {
cacheName: 'image-resources',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
},
},
},
{
urlPattern: /\.(?:woff|woff2|ttf|otf)$/,
handler:'CacheFirst',
options: {
cacheName: 'font-resources',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 90, // 3 months
},
},
},
{
urlPattern: /^https?.*/,
handler: 'NetworkFirst',
options: {
cacheName: 'external-resources',
expiration: {
maxEntries: 260
},
},
},
],
}),
],
optimization: {
splitChunks: {
Expand Down
10 changes: 7 additions & 3 deletions config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ module.exports = {
clientsClaim: true,
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
runtimeCaching: [
{
urlPattern: /env-config\.js$/,
handler: 'NetworkOnly'
},
{
urlPattern: /\.(?:js|css)$/,
handler: 'CacheFirst',
handler: 'NetworkFirst',
options: {
cacheName: 'static-resources',
expiration: {
Expand All @@ -65,7 +69,7 @@ module.exports = {
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
handler: 'CacheFirst',
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'image-resources',
expiration: {
Expand All @@ -75,7 +79,7 @@ module.exports = {
},
{
urlPattern: /\.(?:woff|woff2|ttf|otf)$/,
handler:'CacheFirst',
handler:'StaleWhileRevalidate',
options: {
cacheName: 'font-resources',
expiration: {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "streetcode",
"author": "SoftServe IT Academy (https://career.softserveinc.com/uk-ua/)",
"license": "MIT",
"version": "0.1.0",
"version": "1.0.0",
"private": true,
"dependencies": {
"@ant-design/icons": "^4.8.0",
Expand Down
1 change: 1 addition & 0 deletions public/env-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ window._env_ = {
API_URL: "https://stageback.streetcode.com.ua/api",
REACT_APP_GOOGLE_ANALYTICS: "REACT_APP_GOOGLE_ANALYTICS_VALUE",
RECAPTCHA_SITE_KEY: "6LeUO3ApAAAAAOC7F4v0qTsSwIR9mZu33SWjAAtM",
VERSION: "1.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ const ArtGallery = ({
if (streetcodeIdValidAndFetchingRequired()) {
secondRender.current = true;
if (isFillArtsStore) {
await fetchAllToDefaultTemplate(getStreetCodeId !== -1 ? getStreetCodeId : parseId);
let currStreetcodeId = getStreetCodeId !== -1 ? getStreetCodeId : parseId;
const startingSlide = await fetchAllToDefaultTemplate(currStreetcodeId);

let currentSlide = 0;
let currentSlide = startingSlide ?? 0;
while (currentSlide < MAX_SLIDES_AMOUNT) {
try {
// eslint-disable-next-line no-await-in-loop
await fetchAllArtSlidesByStreetcodeId(getStreetCodeId !== -1 ? getStreetCodeId : parseId, currentSlide);
await fetchAllArtSlidesByStreetcodeId(currStreetcodeId, currentSlide);

currentSlide += amountOfSlides;
} catch (error: unknown) {
Expand Down Expand Up @@ -340,4 +341,4 @@ const ArtGallery = ({
);
};

export default observer(ArtGallery);
export default observer(ArtGallery);
39 changes: 39 additions & 0 deletions src/app/common/components/withClearCache.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-underscore-dangle */
import { useEffect, useState } from 'react';

const WithClearCache: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const [isLatestBuildDate, setIsLatestBuildDate] = useState<boolean>(true);

const refreshCacheAndReload = () => {
if (caches) {
caches.keys().then((names) => {
for (const name of names) {
caches.delete(name);
}
console.log('Cache is cleared');
window.location.reload();
});
}
};

useEffect(() => {
const localVersion = localStorage.getItem('VERSION');
const envVersion = window._env_.VERSION;
if (typeof envVersion !== 'undefined') {
const isVersionMatches = localVersion === envVersion;
setIsLatestBuildDate(isVersionMatches);
if (!isVersionMatches) {
localStorage.setItem('VERSION', envVersion);
refreshCacheAndReload();
}
}
}, [isLatestBuildDate]);

if (isLatestBuildDate) {
return children;
}
return null;
};

export default WithClearCache;
12 changes: 8 additions & 4 deletions src/app/stores/streetcode-art-slide-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ export default class StreetcodeArtSlideStore {
}
};

public fetchAllToDefaultTemplate = async (streetcodeid: number) => {
const slidesCount = await StreetcodeArtApi.getAllCountByStreetcodeId(streetcodeid)
this.streetcodeArtSlides = new Array<StreetcodeArtSlideAdmin>(slidesCount).fill(bindStreetcodeIdToDefaultSlide(streetcodeid), 0, slidesCount)
public fetchAllToDefaultTemplate = async (streetcodeId: number): Promise<number | void> => {
if (this.streetcodeWasFetched.includes(streetcodeId)) {return;}
const startingPosition = this.streetcodeArtSlides.length;
const slidesCount = await StreetcodeArtApi.getAllCountByStreetcodeId(streetcodeId)
const placeholders = new Array<StreetcodeArtSlideAdmin>(slidesCount).fill(bindStreetcodeIdToDefaultSlide(streetcodeId), 0, slidesCount);
this.streetcodeArtSlides.push(...placeholders);
return startingPosition;
}

public fetchAllArtSlidesByStreetcodeId = async (streetcodeid: number, startIndex: number) => {
Expand Down Expand Up @@ -125,4 +129,4 @@ export default class StreetcodeArtSlideStore {
return convertedSlide as unknown as StreetcodeArtSlideCreateUpdate;
});
}
}
}
13 changes: 3 additions & 10 deletions src/features/AdminPage/TeamPage/TeamLink.component.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import React from 'react';
import behance from '@assets/images/partners/behance.svg';
import facebook from '@assets/images/partners/facebook.svg';
import http from '@assets/images/partners/http.svg';
import instagram from '@assets/images/partners/instagram.svg';
import linkedin from '@assets/images/partners/linkedin.svg';
import tiktok from '@assets/images/partners/tiktok.svg';
import twitter from '@assets/images/partners/twitterNew.svg';
import youtube from '@assets/images/partners/youtube.svg';

import { TeamMemberLinkCreateUpdate } from '@/models/team/team.model';

const LogoType = [twitter, instagram, facebook, youtube, linkedin, tiktok, behance, http];
import LOGO_ICONS from './TeamModal/constants/logoIcons';

const TeamLink: React.FC<{ link: TeamMemberLinkCreateUpdate }> = ({ link }) => {
const LogoComponent = LogoType[link.logoType];
const LogoComponent = LOGO_ICONS.find( logo => logo.type === link.logoType)!.icon;

return (
<a
Expand Down
Loading

0 comments on commit 7836685

Please sign in to comment.