Skip to content

Commit 08a4928

Browse files
committed
feat: enhance AddressBar and Toolbar components with new props for improved functionality
1 parent ac86e7a commit 08a4928

2 files changed

Lines changed: 28 additions & 14 deletions

File tree

src/features/browser/screens/BrowserScreen/AddressBar.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ import { formatUrlForDisplay } from "../../utils/urlUtils";
88

99
interface AddressBarProps {
1010
onFocusChange?: (isFocused: boolean) => void;
11+
onReload: () => void;
12+
onStop: () => void;
1113
}
1214

13-
export default function AddressBar({ onFocusChange }: AddressBarProps) {
15+
export default function AddressBar({
16+
onFocusChange,
17+
onReload,
18+
onStop,
19+
}: AddressBarProps) {
1420
const theme = useTheme();
1521
const { activeTab, navigateTab, activeTabId } = useBrowser();
1622

@@ -74,13 +80,21 @@ export default function AddressBar({ onFocusChange }: AddressBarProps) {
7480
/>
7581
<View style={[styles.iconRight]}>
7682
<IconButton
77-
icon={activeTab?.url && !isFocused ? Icons.refresh : Icons.microphone}
83+
icon={
84+
activeTab?.isLoading
85+
? Icons.stop
86+
: activeTab?.url && !isFocused
87+
? Icons.refresh
88+
: Icons.microphone
89+
}
7890
color={theme.colors.textSecondary}
7991
size={26}
8092
accessibilityLabel={activeTab?.url ? "Reload" : "Start voice search"}
8193
onPress={() => {
82-
if (activeTabId && activeTab?.url) {
83-
navigateTab(activeTabId, activeTab.url);
94+
if (activeTab?.isLoading) {
95+
onStop();
96+
} else if (activeTabId && activeTab?.url) {
97+
onReload();
8498
}
8599
}}
86100
/>

src/features/browser/screens/BrowserScreen/Toolbar.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ import { StyleSheet } from "react-native";
66
import { SafeAreaView } from "react-native-safe-area-context";
77
import { useBrowser } from "../../hooks/useBrowser";
88

9-
export default function Toolbar() {
9+
type ToolbarProps = {
10+
onBack: () => void;
11+
onForward: () => void;
12+
onShare?: () => void;
13+
};
14+
15+
export default function Toolbar({ onBack, onForward, onShare }: ToolbarProps) {
1016
const theme = useTheme();
1117
const {
1218
activeTab,
@@ -25,28 +31,22 @@ export default function Toolbar() {
2531
size={26}
2632
disabled={!activeTab?.canGoBack}
2733
accessibilityLabel="Back"
28-
onPress={() => {
29-
// WebView navigation logic will go here
30-
}}
34+
onPress={onBack}
3135
/>
3236
<IconButton
3337
icon={Icons.forward}
3438
color={theme.colors.textPrimary}
3539
size={26}
3640
disabled={!activeTab?.canGoForward}
3741
accessibilityLabel="Forward"
38-
onPress={() => {
39-
// WebView navigation logic will go here
40-
}}
42+
onPress={onForward}
4143
/>
4244
<IconButton
4345
icon={Icons.share}
4446
color={theme.colors.textPrimary}
4547
size={26}
4648
accessibilityLabel="Share"
47-
onPress={() => {
48-
// More actions (settings, share, etc.)
49-
}}
49+
onPress={onShare}
5050
/>
5151
<IconButton
5252
icon={

0 commit comments

Comments
 (0)