Skip to content

Commit 5bca99e

Browse files
authored
Merge pull request #865 from karrioapi/fix/web-dark-mode-readability
[fix] dark mode readability in docs
2 parents 0f7edaf + ab98c8f commit 5bca99e

38 files changed

Lines changed: 470 additions & 254 deletions

File tree

apps/web/src/app/docs/api-reference/page.tsx

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,21 @@ declare global {
2020
}
2121

2222
export default function ApiReferencePage() {
23-
const { theme } = useTheme();
23+
const { resolvedTheme } = useTheme();
2424
const [mounted, setMounted] = useState(false);
25+
const getStoredTheme = (): 'light' | 'dark' => {
26+
if (typeof window === 'undefined') return 'light';
27+
try {
28+
const stored = window.localStorage.getItem('theme-content');
29+
if (stored === 'dark' || stored === 'light') return stored;
30+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) return 'dark';
31+
} catch { }
32+
return 'light';
33+
};
34+
// Revert to light-mode-only code styling (rely on component defaults for dark)
35+
useEffect(() => {
36+
if (!mounted) return;
37+
}, [mounted]);
2538

2639
useEffect(() => {
2740
setMounted(true);
@@ -30,11 +43,21 @@ export default function ApiReferencePage() {
3043
return (
3144
<div className="w-full h-full bg-background dark:bg-neutral-950">
3245
<elements-api
46+
key={(mounted ? (resolvedTheme as 'light' | 'dark' | undefined) : undefined) ?? getStoredTheme()}
3347
apiDescriptionUrl="/openapi.yml"
3448
router="hash"
3549
layout="responsive"
36-
theme={mounted ? (theme === 'dark' ? 'dark' : 'light') : 'light'}
37-
className="w-full h-[calc(100vh-56px)]"
50+
theme={((mounted ? resolvedTheme : undefined) ?? getStoredTheme()) === 'dark' ? 'dark' : 'light'}
51+
className="w-full h-[calc(100vh-56px)] custom-docs-theme"
52+
data-theme={(mounted ? (resolvedTheme as 'light' | 'dark' | undefined) : undefined) ?? getStoredTheme()}
53+
style={{
54+
background: 'transparent',
55+
// Attempt to override internal surface variables used by some web components
56+
['--color-canvas' as any]: 'transparent',
57+
['--color-bg' as any]: 'transparent',
58+
['--sl-color-bg' as any]: 'transparent',
59+
['--sl-color-surface' as any]: 'transparent'
60+
} as React.CSSProperties}
3861
hideSchemas="true"
3962
hideTryIt="true"
4063
/>

apps/web/src/app/docs/developing/carrier-integration/page.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ flowchart TD
3232
Test --> Validate[Validate Integration]
3333
Validate --> End([Complete])
3434
35-
style Start fill:#f9f,stroke:#333,stroke-width:2px
36-
style End fill:#9f9,stroke:#333,stroke-width:2px
35+
3736
```
3837

3938
## Prerequisites

apps/web/src/app/docs/developing/dashboard-guide/developer-tools/page.mdx

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,11 @@ Direct links to common developer tasks:
105105
- **Check Logs**: Monitor recent API activity
106106
- **Configure Webhooks**: Set up event notifications
107107

108-
<div className="bg-blue-50 dark:bg-blue-900 rounded-lg p-4 my-6">
109-
<div className="text-sm text-blue-700 dark:text-blue-300 mb-2">
110-
💡 Developer Dashboard Benefits
111-
</div>
112-
<p className="text-sm text-blue-600 dark:text-blue-400">
113-
The developer dashboard provides real-time visibility into your integration
114-
health, helping you monitor performance, debug issues, and optimize your
115-
implementation.
116-
</p>
117-
</div>
108+
> [!TIP]
109+
>
110+
> **Developer Dashboard Benefits**
111+
>
112+
> The developer dashboard provides real-time visibility into your integration health, helping you monitor performance, debug issues, and optimize your implementation.
118113
119114
## API Keys Management
120115

@@ -244,16 +239,11 @@ Handle webhook events effectively:
244239
}
245240
```
246241

247-
<div className="bg-orange-50 dark:bg-orange-900 rounded-lg p-4 my-6">
248-
<div className="text-sm text-orange-700 dark:text-orange-300 mb-2">
249-
⚠️ Webhook Security
250-
</div>
251-
<p className="text-sm text-orange-600 dark:text-orange-400">
252-
Always validate webhook signatures to ensure events come from Karrio. Store
253-
webhook secrets securely and use HTTPS endpoints for receiving
254-
notifications.
255-
</p>
256-
</div>
242+
> [!WARNING]
243+
>
244+
> **Webhook Security**
245+
>
246+
> Always validate webhook signatures to ensure events come from Karrio. Store webhook secrets securely and use HTTPS endpoints for receiving notifications.
257247
258248
## API Logs and Monitoring
259249

@@ -544,16 +534,11 @@ Built-in debugging assistance:
544534
- **Endpoint Efficiency**: Choose optimal API endpoints
545535
- **Batch Processing**: Reduce API call overhead
546536

547-
<div className="bg-blue-50 dark:bg-blue-900 rounded-lg p-4 my-6">
548-
<div className="text-sm text-blue-700 dark:text-blue-300 mb-2">
549-
💡 Developer Best Practices
550-
</div>
551-
<p className="text-sm text-blue-600 dark:text-blue-400">
552-
Use the developer tools regularly to monitor integration health, debug
553-
issues proactively, and optimize performance. Set up appropriate alerts and
554-
monitoring to catch issues before they impact users.
555-
</p>
556-
</div>
537+
> [!TIP]
538+
>
539+
> **Developer Best Practices**
540+
>
541+
> Use the developer tools regularly to monitor integration health, debug issues proactively, and optimize performance. Set up appropriate alerts and monitoring to catch issues before they impact users.
557542
558543
## API Usage Optimization
559544

apps/web/src/app/docs/developing/dashboard-guide/document-templates/page.mdx

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,11 @@ Build templates with the visual designer:
142142
- **Shipping Info**: Carriers, services, tracking
143143
- **Company Details**: Business information
144144

145-
<div className="bg-blue-50 dark:bg-blue-900 rounded-lg p-4 my-6">
146-
<div className="text-sm text-blue-700 dark:text-blue-300 mb-2">
147-
💡 Template Variables
148-
</div>
149-
<p className="text-sm text-blue-600 dark:text-blue-400">
150-
Use template variables like `{order.order_id}` or `{customer.name}` to
151-
dynamically populate document content. The system automatically replaces
152-
these with actual data when generating documents.
153-
</p>
154-
</div>
145+
> [!TIP]
146+
>
147+
> **Template Variables**
148+
>
149+
> Use template variables like `{order.order_id}` or `{customer.name}` to dynamically populate document content. The system automatically replaces these with actual data when generating documents.
155150
156151
## Template Designer Features
157152

@@ -302,16 +297,11 @@ Show content based on conditions:
302297
{{formatTime shipment.pickup_time "h:mm A"}}
303298
```
304299

305-
<div className="bg-orange-50 dark:bg-orange-900 rounded-lg p-4 my-6">
306-
<div className="text-sm text-orange-700 dark:text-orange-300 mb-2">
307-
⚠️ Data Availability
308-
</div>
309-
<p className="text-sm text-orange-600 dark:text-orange-400">
310-
Template variables depend on the context where the template is used. Not all
311-
data is available in every situation. Test templates thoroughly with
312-
different data scenarios.
313-
</p>
314-
</div>
300+
> [!WARNING]
301+
>
302+
> **Data Availability**
303+
>
304+
> Template variables depend on the context where the template is used. Not all data is available in every situation. Test templates thoroughly with different data scenarios.
315305
316306
## Template Management
317307

apps/web/src/app/docs/developing/dashboard-guide/label-creation/page.mdx

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,11 @@ Add optional services:
125125
- **Declared Value**: Custom value declaration
126126
- **Hold at Location**: Delivery to pickup location
127127

128-
<div className="bg-blue-50 dark:bg-blue-900 rounded-lg p-4 my-6">
129-
<div className="text-sm text-blue-700 dark:text-blue-300 mb-2">
130-
💡 Smart Defaults
131-
</div>
132-
<p className="text-sm text-blue-600 dark:text-blue-400">
133-
The form remembers your preferences and automatically populates common
134-
options like currency, shipping date, and package types based on your
135-
previous shipments.
136-
</p>
137-
</div>
128+
> [!TIP]
129+
>
130+
> **Smart Defaults**
131+
>
132+
> The form remembers your preferences and automatically populates common options like currency, shipping date, and package types based on your previous shipments.
138133
139134
### 4. Rate Comparison
140135

@@ -211,15 +206,11 @@ For each item in the shipment:
211206
- **Unit Value**: Price per item
212207
- **Origin Country**: Country of manufacture
213208

214-
<div className="bg-orange-50 dark:bg-orange-900 rounded-lg p-4 my-6">
215-
<div className="text-sm text-orange-700 dark:text-orange-300 mb-2">
216-
⚠️ Customs Accuracy
217-
</div>
218-
<p className="text-sm text-orange-600 dark:text-orange-400">
219-
Accurate customs information is required for international shipments.
220-
Incorrect declarations can cause delays, additional fees, or customs holds.
221-
</p>
222-
</div>
209+
> [!WARNING]
210+
>
211+
> **Customs Accuracy**
212+
>
213+
> Accurate customs information is required for international shipments. Incorrect declarations can cause delays, additional fees, or customs holds.
223214
224215
## Payment and Billing
225216

apps/web/src/app/docs/developing/dashboard-guide/page.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ flowchart TD
9797
F --> G[Automatic Tracking]
9898
G --> H[Delivery Updates]
9999
100-
style A fill:#e1f5fe
101-
style D fill:#fff3e0
102-
style F fill:#e8f5e8
103-
style H fill:#f3e5f5
104100
```
105101

106102
## Best Practices

apps/web/src/app/docs/developing/dashboard-guide/test-mode/page.mdx

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,11 @@ Test mode uses carrier sandbox APIs and test credentials, allowing you to:
4949
- **Tracking**: Monitor simulated package deliveries
5050
- **Error Handling**: Test edge cases and error scenarios
5151

52-
<div className="bg-blue-50 dark:bg-blue-900 rounded-lg p-4 my-6">
53-
<div className="text-sm text-blue-700 dark:text-blue-300 mb-2">
54-
💡 Test Mode Indicators
55-
</div>
56-
<p className="text-sm text-blue-600 dark:text-blue-400">
57-
Test mode is clearly indicated throughout the dashboard with visual cues
58-
including orange badges, test data watermarks, and sandbox API endpoints.
59-
</p>
60-
</div>
52+
> [!TIP]
53+
>
54+
> **Test Mode Indicators**
55+
>
56+
> Test mode is clearly indicated throughout the dashboard with visual cues including orange badges, test data watermarks, and sandbox API endpoints.
6157
6258
### Test Mode Features
6359

@@ -241,15 +237,11 @@ Live mode connects to production carrier APIs for real shipping operations:
241237
- **Tracking Updates**: Real delivery status notifications
242238
- **Label Printing**: Functional shipping labels
243239

244-
<div className="bg-orange-50 dark:bg-orange-900 rounded-lg p-4 my-6">
245-
<div className="text-sm text-orange-700 dark:text-orange-300 mb-2">
246-
⚠️ Production Considerations
247-
</div>
248-
<p className="text-sm text-orange-600 dark:text-orange-400">
249-
Live mode processes real transactions. Ensure your integrations are
250-
thoroughly tested in test mode before switching to live operations.
251-
</p>
252-
</div>
240+
> [!WARNING]
241+
>
242+
> **Production Considerations**
243+
>
244+
> Live mode processes real transactions. Ensure your integrations are thoroughly tested in test mode before switching to live operations.
253245
254246
## Switching Between Modes
255247

apps/web/src/app/docs/developing/dashboard-guide/trackers/page.mdx

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,11 @@ Karrio supports tracking from major carriers:
125125
- **Canada Post**: Domestic and international services
126126
- **And many more**: Regional and specialty carriers
127127

128-
<div className="bg-blue-50 dark:bg-blue-900 rounded-lg p-4 my-6">
129-
<div className="text-sm text-blue-700 dark:text-blue-300 mb-2">
130-
💡 Smart Carrier Detection
131-
</div>
132-
<p className="text-sm text-blue-600 dark:text-blue-400">
133-
Karrio can often detect the carrier automatically based on tracking number
134-
format, making the tracking setup process faster and more accurate.
135-
</p>
136-
</div>
128+
> [!TIP]
129+
>
130+
> **Smart Carrier Detection**
131+
>
132+
> Karrio can often detect the carrier automatically based on tracking number format, making the tracking setup process faster and more accurate.
137133
138134
## Tracking Status Codes
139135

@@ -261,16 +257,11 @@ Trackers automatically link with:
261257
- **Customer Updates**: Automatic tracking notifications
262258
- **Delivery Confirmation**: Order completion tracking
263259

264-
<div className="bg-orange-50 dark:bg-orange-900 rounded-lg p-4 my-6">
265-
<div className="text-sm text-orange-700 dark:text-orange-300 mb-2">
266-
⚠️ Tracking Limitations
267-
</div>
268-
<p className="text-sm text-orange-600 dark:text-orange-400">
269-
Tracking accuracy depends on carrier data quality and update frequency. Some
270-
carriers provide more detailed information than others, and rural deliveries
271-
may have fewer tracking events.
272-
</p>
273-
</div>
260+
> [!WARNING]
261+
>
262+
> **Tracking Limitations**
263+
>
264+
> Tracking accuracy depends on carrier data quality and update frequency. Some carriers provide more detailed information than others, and rural deliveries may have fewer tracking events.
274265
275266
## Analytics and Reporting
276267

apps/web/src/app/docs/platform/app-store/api-integration/page.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Karrio provides comprehensive APIs that allow your apps to:
4343
Karrio offers multiple API interfaces to suit different use cases:
4444

4545
```mermaid
46-
graph TB
46+
graph LR
4747
A[Your Karrio App] --> B[Authentication Layer]
4848
B --> C[GraphQL API]
4949
B --> D[REST API v1]
@@ -61,10 +61,7 @@ graph TB
6161
E --> M[Real-time Updates]
6262
E --> N[Event Notifications]
6363
64-
style A fill:#e3f2fd
65-
style C fill:#e8f5e8
66-
style D fill:#fff3e0
67-
style E fill:#fce4ec
64+
6865
```
6966

7067
## GraphQL API

apps/web/src/app/docs/platform/app-store/deployment/page.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Learn how to deploy your Karrio Apps to production with confidence, including te
3232
Karrio Apps can be deployed in several ways depending on your architecture and requirements:
3333

3434
```mermaid
35-
graph TB
35+
graph LR
3636
A[Development] --> B[Testing]
3737
B --> C[Staging]
3838
C --> D[Production]
@@ -67,10 +67,7 @@ graph TB
6767
C --> K
6868
D --> N
6969
70-
style A fill:#e3f2fd
71-
style B fill:#e8f5e8
72-
style C fill:#fff3e0
73-
style D fill:#fce4ec
70+
7471
```
7572

7673
## Development Setup

0 commit comments

Comments
 (0)