Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions channels.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,5 +411,20 @@
"type": "island",
"url": "https://app.slack.com/client/E09V59WQY1E/C0B7H73EU7L",
"id": "C0B7H73EU7L"
},
{
"channel":"kerala",
"match":"kerala",
"type":"indian-state",
"url": "https://app.slack.com/client/E09V59WQY1E/C08D8B0STPE",
"id":"C08D8B0STPE"

},
Comment on lines +416 to +422
{
"channel":"tamil-nadu",
"match":"tamil-nadu",
"type":"indian-state",
"url":"https://app.slack.com/client/E09V59WQY1E/C0AU3ELADMK",
"id": "C0AU3ELADMK"
}
]
12 changes: 8 additions & 4 deletions components/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,24 @@ function Header({ unfixed, color, bgColor, dark, fixed, ...props }) {
}

useEffect(() => {
if (typeof window !== 'undefined') {
if (typeof window === 'undefined') return

if (!unfixed) {
window.addEventListener('scroll', onScroll)
}

const mobileQuery = window.matchMedia('(max-width: 48em)')
mobileQuery.addEventListener('change', (e) => {
const handleMobileChange = (e) => {
setMobile(e.matches)
setToggled(false)
})
}
}
mobileQuery.addEventListener('change',handleMobileChange)
setMobile(mobileQuery.matches)


return () => {
window.removeEventListener('scroll', onScroll)
mobileQuery.removeEventListener('change',handleMobileChange)
}
}, [unfixed])

Expand Down
32 changes: 18 additions & 14 deletions components/slides/Slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,22 +469,26 @@ const Slides = ({ isOpen, onClose }) => {
return () => window.removeEventListener('keydown', handleKeyDown)
}, [isOpen, currentX, currentY, handleAction, onClose])

useEffect(() => {
if (currentY === 1 && slideData[currentX]?.downSlide?.type === 'fetch') {
setConductData({ content: null, loading: true, error: null })
fetch('/api/conduct')
.then((res) => {
if (!res.ok) throw new Error('Failed to fetch')
useEffect(()=>{
if(currentY===1&&slideData[currentX]?.downSlide?.type==='fetch'){
const controller=new AbortController()
setConductData({content:null,loading:true,error:null})
fetch('/api/conduct',{signal:controller.signal})
.then((res)=>{
if(!res.ok)throw new Error("failed to fetch")
return res.text()
Comment on lines +476 to 479
})
.then((html) => {
setConductData({ content: html, loading: false, error: null })
})
.catch(() => {
setConductData({ content: null, loading: false, error: true })
})
})
.then((html)=>{
setConductData({content:html,loading:false,error:null})

})
.catch((err)=>{
if(err.name==='AbortError')return
setConductData({content:null,loading:false,error:true})
})
return()=>controller.abort()
}
}, [currentX, currentY])
},[currentX,currentY])

if (!isOpen) return null

Expand Down
14 changes: 11 additions & 3 deletions pages/channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const formatName = (str) =>
const getTypeLabel = (type) => {
if (type === 'us-state') return 'US State'
if (type === 'island') return 'Island'
if (type === 'indian-state')return 'Indian State'
return 'Country'
}
Comment on lines 14 to 19

Expand Down Expand Up @@ -103,14 +104,15 @@ const ChannelsPage = () => {
const [filter, setFilter] = useState('all')

const filtered = useMemo(() => {
return channels.filter((c) => {
return channels.filter((c) => {
const matchesSearch =
c.channel.includes(search.toLowerCase()) ||
c.match.includes(search.toLowerCase())
c.channel.toLowerCase().includes(search.toLowerCase()) ||
c.match.toLowerCase().includes(search.toLowerCase())
const matchesFilter =
Comment on lines 106 to 111
filter === 'all' ||
(filter === 'country' && c.type === 'country') ||
(filter === 'us-state' && c.type === 'us-state') ||
(filter === 'indian-state' && c.type==='indian-state') ||
(filter === 'island' && c.type === 'island')
return matchesSearch && matchesFilter
})
Expand All @@ -120,7 +122,9 @@ const ChannelsPage = () => {
all: channels.length,
country: channels.filter((c) => c.type === 'country').length,
'us-state': channels.filter((c) => c.type === 'us-state').length,
'indian-state':channels.filter((c)=>c.type==='indian-state').length,
island: channels.filter((c) => c.type === 'island').length

}), [])

return (
Expand Down Expand Up @@ -236,6 +240,10 @@ const ChannelsPage = () => {
<FilterButton active={filter === 'island'} onClick={() => setFilter('island')}>
Islands ({counts.island})
</FilterButton>
<FilterButton active={filter==='indian-state'} onClick={()=>setFilter('indian-state')}>
Indian States({counts['indian-state']})
</FilterButton>

Comment on lines +243 to +246
</Box>
</Box>

Expand Down