Skip to content

Commit 3d0fc52

Browse files
ChengaDevclaude
andcommitted
Remove unused consent state variable in CookieBanner
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 77c5ec8 commit 3d0fc52

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

src/components/CookieBanner.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React, { useEffect, useState } from 'react'
22
import styled, { keyframes } from 'styled-components'
33
import { Link } from 'react-router-dom'
44

5-
type ConsentValue = 'granted' | 'denied' | null
6-
75
const STORAGE_KEY = 'cookie_consent'
86

97
function updateGoogleConsent(value: 'granted' | 'denied') {
@@ -18,11 +16,10 @@ function updateGoogleConsent(value: 'granted' | 'denied') {
1816
}
1917

2018
const CookieBanner = () => {
21-
const [consent, setConsent] = useState<ConsentValue>(null)
2219
const [visible, setVisible] = useState(false)
2320

2421
useEffect(() => {
25-
const stored = localStorage.getItem(STORAGE_KEY) as ConsentValue
22+
const stored = localStorage.getItem(STORAGE_KEY) as 'granted' | 'denied' | null
2623
if (stored === 'granted' || stored === 'denied') {
2724
// Re-apply saved choice on every page load so Consent Mode is always in sync
2825
updateGoogleConsent(stored)
@@ -36,14 +33,12 @@ const CookieBanner = () => {
3633
const handleAccept = () => {
3734
localStorage.setItem(STORAGE_KEY, 'granted')
3835
updateGoogleConsent('granted')
39-
setConsent('granted')
4036
setVisible(false)
4137
}
4238

4339
const handleDecline = () => {
4440
localStorage.setItem(STORAGE_KEY, 'denied')
4541
updateGoogleConsent('denied')
46-
setConsent('denied')
4742
setVisible(false)
4843
}
4944

0 commit comments

Comments
 (0)