Commit d4af5fa
committed
refactor: simplify gateway API with clearer naming
Rename useGatewayModels → useGateway with cleaner interface:
- isActive: gateway configured AND enabled (ready to use)
- isConfigured: coupon code set
- isEnabled: global master switch on
- canToggleModel(id): whether to show gateway toggle for model
- modelUsesGateway(id): model is toggled for gateway
- isModelRoutingThroughGateway(id): active + uses (for display)
- toggleEnabled(): toggle global switch
- toggleModelGateway(id): toggle per-model
Consolidates scattered checks like:
gatewayGloballyEnabled && gatewayAvailable && isGatewaySupported(model)
Into single semantic calls:
gateway.canToggleModel(model)
Also renames isGatewaySupported → isProviderSupported for clarity.1 parent 805fdca commit d4af5fa
File tree
4 files changed
+152
-154
lines changed- src/browser
- components
- Settings/sections
- hooks
4 files changed
+152
-154
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 32 | + | |
38 | 33 | | |
39 | 34 | | |
40 | 35 | | |
| |||
198 | 193 | | |
199 | 194 | | |
200 | 195 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
| 196 | + | |
206 | 197 | | |
207 | 198 | | |
208 | | - | |
| 199 | + | |
209 | 200 | | |
210 | 201 | | |
211 | 202 | | |
| |||
274 | 265 | | |
275 | 266 | | |
276 | 267 | | |
277 | | - | |
278 | | - | |
| 268 | + | |
| 269 | + | |
279 | 270 | | |
280 | 271 | | |
281 | 272 | | |
282 | 273 | | |
283 | 274 | | |
284 | 275 | | |
285 | 276 | | |
286 | | - | |
| 277 | + | |
287 | 278 | | |
288 | 279 | | |
289 | 280 | | |
290 | | - | |
| 281 | + | |
291 | 282 | | |
292 | 283 | | |
293 | 284 | | |
294 | 285 | | |
295 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
296 | 289 | | |
297 | 290 | | |
298 | 291 | | |
299 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
300 | 296 | | |
301 | 297 | | |
302 | 298 | | |
303 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
304 | 302 | | |
305 | 303 | | |
306 | 304 | | |
| |||
Lines changed: 8 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 32 | + | |
38 | 33 | | |
39 | 34 | | |
40 | 35 | | |
| |||
225 | 220 | | |
226 | 221 | | |
227 | 222 | | |
228 | | - | |
| 223 | + | |
229 | 224 | | |
230 | 225 | | |
231 | 226 | | |
| |||
235 | 230 | | |
236 | 231 | | |
237 | 232 | | |
238 | | - | |
239 | | - | |
| 233 | + | |
| 234 | + | |
240 | 235 | | |
241 | 236 | | |
242 | 237 | | |
| |||
259 | 254 | | |
260 | 255 | | |
261 | 256 | | |
262 | | - | |
| 257 | + | |
263 | 258 | | |
264 | 259 | | |
265 | | - | |
266 | | - | |
| 260 | + | |
| 261 | + | |
267 | 262 | | |
268 | 263 | | |
269 | 264 | | |
| |||
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
| 322 | + | |
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
| 330 | + | |
331 | 331 | | |
332 | | - | |
| 332 | + | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
| 339 | + | |
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| |||
0 commit comments