Skip to content

Commit 8a48bf9

Browse files
committed
Remove generic 'handle' prefix from function names in Social Web UI.
Renamed functions to better describe their purpose: - handleChangeSelection → changeSelection - handleHashChange → syncUrlToState - handleSelectItem → selectItem - handleCloseInspector → closeInspector - handleNavigate → navigate
1 parent e616cc8 commit 8a48bf9

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/social-web/components/layout/index.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,37 +76,37 @@ export function Layout() {
7676

7777
// Listen for hash changes (back/forward navigation)
7878
useEffect( () => {
79-
const handleHashChange = () => {
79+
const syncUrlToState = () => {
8080
const { section, itemId } = parseHash();
8181
setActiveSection( section );
8282
setSelectedItemId( itemId );
8383
};
8484

85-
window.addEventListener( 'hashchange', handleHashChange );
85+
window.addEventListener( 'hashchange', syncUrlToState );
8686
return () => {
87-
window.removeEventListener( 'hashchange', handleHashChange );
87+
window.removeEventListener( 'hashchange', syncUrlToState );
8888
};
8989
}, [] );
9090

91-
const handleSelectItem = ( id: string | number ) => {
91+
const selectItem = ( id: string | number ) => {
9292
setSelectedItemId( id );
9393
updateHash( activeSection, id );
9494
};
9595

96-
const handleCloseInspector = () => {
96+
const closeInspector = () => {
9797
setSelectedItemId( null );
9898
updateHash( activeSection );
9999
};
100100

101-
const handleNavigate = ( section: string ) => {
101+
const navigate = ( section: string ) => {
102102
setActiveSection( section );
103103
setSelectedItemId( null );
104104
updateHash( section );
105105
};
106106

107107
// Render main content (stage) with Suspense for lazy loading
108108
const renderStage = () => {
109-
const props = { onSelectItem: handleSelectItem };
109+
const props = { onSelectItem: selectItem };
110110

111111
let StageComponent;
112112
switch ( activeSection ) {
@@ -145,7 +145,7 @@ export function Layout() {
145145
return null;
146146
}
147147
InspectorComponent = FeedInspector;
148-
props = { id: selectedItemId, onClose: handleCloseInspector };
148+
props = { id: selectedItemId, onClose: closeInspector };
149149
}
150150

151151
return (
@@ -169,7 +169,7 @@ export function Layout() {
169169
<div className="app-content">
170170
{ /* Sidebar - 240px fixed width (no Panel wrapper, stays dark) */ }
171171
<div className="sidebar-region">
172-
<Sidebar activeSection={ activeSection } onNavigate={ handleNavigate } />
172+
<Sidebar activeSection={ activeSection } onNavigate={ navigate } />
173173
</div>
174174

175175
{ /* Stage - main content area */ }

src/social-web/routes/feed/stage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default function FeedStage( { onSelectItem }: FeedStageProps ) {
8181
}
8282
}, [ feed, selection ] );
8383

84-
const handleChangeSelection = useCallback(
84+
const changeSelection = useCallback(
8585
( nextSelection: string[] ) => {
8686
setSelection( nextSelection );
8787

@@ -116,7 +116,7 @@ export default function FeedStage( { onSelectItem }: FeedStageProps ) {
116116
isItemClickable={ () => true }
117117
getItemId={ ( item ) => item.id.toString() }
118118
selection={ selection }
119-
onChangeSelection={ handleChangeSelection }
119+
onChangeSelection={ changeSelection }
120120
empty={
121121
<p>
122122
{ view.search

0 commit comments

Comments
 (0)