Skip to content

Commit

Permalink
⬆️ Upgraded latest rules widget package (#1646)
Browse files Browse the repository at this point in the history
* added different cors for staging

* added new variable

* passed location param to widget component, reduced number of rules to 5

* upgraded widget package to new version

* removed 'Latest Rules' link as latest rules widget already has this link

* remove comment

* renamed variable

* upgraded widget package to 2.0.8

* added style for see-more link
  • Loading branch information
babakamyljanovssw authored Nov 25, 2024
1 parent 1f7647f commit 2b97103
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 30 deletions.
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SITE_URL=#{SITE_URL}
GOOGLE_ANALYTICS=#{GOOGLE_ANALYTICS}
DEPLOYMENT_URL=#{DEPLOYMENT_URL}
VERSION_DEPLOYED=#{VERSION_DEPLOYED}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/template-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
tokenSuffix: '}'
files: .env.template
env:
SITE_URL: ${{ vars.SITE_URL }}
GOOGLE_ANALYTICS: ${{ vars.GOOGLE_ANALYTICS }}
DEPLOYMENT_URL: https://github.com/SSWConsulting/SSW.Rules/actions/workflows/build-deploy-production.yml
VERSION_DEPLOYED: ${{ github.run_number }}
Expand Down
14 changes: 10 additions & 4 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = {
}
}

var stagingAllowedOrigins = [
'*'
]

var productionAllowedOrigins = [
'https://ssw.com.au'
'https://www.ssw.com.au'
]

resource blobServices 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01' = {
name: 'default'
parent: storageAccount
Expand All @@ -71,10 +80,7 @@ resource blobServices 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01
'HEAD'
'OPTIONS'
]
allowedOrigins: [
'https://ssw.com.au'
'https://www.ssw.com.au'
]
allowedOrigins: environmentName == 'staging' ? stagingAllowedOrigins : productionAllowedOrigins
exposedHeaders: [
'*'
]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"react-responsive-modal": "^6.4.2",
"sharp": "^0.33.5",
"ssw.megamenu": "4.6.2",
"ssw.rules.widget": "^2.0.5",
"ssw.rules.widget": "^2.0.8",
"svg-react-loader": "^0.4.6",
"webpack-assets-manifest": "5.2.1"
},
Expand Down
3 changes: 1 addition & 2 deletions src/components/side-bar/side-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ const SideBar = ({ ruleTotalNumber, hideCount }) => {
</section>

<section id="widget">
{/*TODO: Fix this - Currently removing to stop this from working until this is fixed */}
<RulesWidget />
<RulesWidget location={process.env.SITE_URL} numberOfRules={5} />
</section>
<section>
<h4>Why all these rules?</h4>
Expand Down
15 changes: 1 addition & 14 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
faArchive,
faBolt,
faFrownOpen,
faPause,
} from '@fortawesome/free-solid-svg-icons';
Expand Down Expand Up @@ -29,19 +28,7 @@ const Index = ({ data, location }) => {
<div className="flex flex-wrap">
<div className="w-full lg:w-3/4 px-4">
<SearchBar toSearch />
<span className="flex items-center">
<h1 className="flex-1 text-3xl font-semibold">Categories</h1>
<Link to={'/latest-rules?size=50'} className="group unstyled">
<FontAwesomeIcon
icon={faBolt}
size="lg"
className="group-hover:text-ssw-red transition ease-in-out delay-75 duration-150"
/>{' '}
<span className="text-lg underline decoration-underline duration-150 group-hover:decoration-ssw-red group-hover:text-ssw-red transition ease-in-out delay-75">
Latest Rules
</span>
</Link>
</span>
<h1 className="flex-1 text-3xl font-semibold">Categories</h1>
<div className="rule-index no-gutters rounded mb-12">
{data.main.nodes.map((element) => {
return element.frontmatter.index.map((category, i) => {
Expand Down
8 changes: 4 additions & 4 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,10 @@ html {
text-decoration: none;
}

#sidebar #widget .see-more-container a {
text-decoration: underline;
}

#sidebar h4 {
font-weight: 600;
text-transform: uppercase;
Expand All @@ -1807,10 +1811,6 @@ html {
transition: color 0.25s ease;
}

#widget a {
text-decoration: none;
}

#sidebar a:hover {
text-decoration:underline;
}
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6869,7 +6869,7 @@ __metadata:
react-responsive-modal: "npm:^6.4.2"
sharp: "npm:^0.33.5"
ssw.megamenu: "npm:4.6.2"
ssw.rules.widget: "npm:^2.0.5"
ssw.rules.widget: "npm:^2.0.8"
svg-react-loader: "npm:^0.4.6"
tailwindcss: "npm:^3.4.12"
webpack-assets-manifest: "npm:5.2.1"
Expand Down Expand Up @@ -24477,9 +24477,9 @@ __metadata:
languageName: node
linkType: hard

"ssw.rules.widget@npm:^2.0.5":
version: 2.0.5
resolution: "ssw.rules.widget@npm:2.0.5"
"ssw.rules.widget@npm:^2.0.8":
version: 2.0.8
resolution: "ssw.rules.widget@npm:2.0.8"
dependencies:
"@tanstack/react-query": "npm:^5.14.1"
date-fns: "npm:^2.30.0"
Expand All @@ -24488,7 +24488,7 @@ __metadata:
react-icons: "npm:^4.12.0"
style-inject: "npm:^0.3.0"
vite-plugin-css-injected-by-js: "npm:^3.3.0"
checksum: 1a56e610d079f59feb58c33d8de27ff38ed9b1e69b41de3b13731b6a058b81227a472ea6e84e6da5c00a1053cfb6999c33017e177ea226316d6bedecda8cb68f
checksum: 4e6e7371b3072c254f02af8809d95e9ba6ddd6c58cbe84c9c3a2ec756dd968cc9689d488427d3ced65bf230c1a8abd624b57812eb0aa8110dfaf79419508cef6
languageName: node
linkType: hard

Expand Down

0 comments on commit 2b97103

Please sign in to comment.