Skip to content

Commit f4a3d3c

Browse files
author
Dominique Chuo
committed
more doc
1 parent 48e74d6 commit f4a3d3c

37 files changed

+3462
-309
lines changed

src/components/docs-gate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface DocsGateProps {
1313
*
1414
* To disable this gate and show docs in production, set SHOW_DOCS_IN_PRODUCTION to true.
1515
*/
16-
const SHOW_DOCS_IN_PRODUCTION = false;
16+
const SHOW_DOCS_IN_PRODUCTION = true;
1717

1818
export function DocsGate({ children }: DocsGateProps) {
1919
const isLocalhost = useIsLocalhost();

src/pages/docs/data/navigation.ts

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,53 @@ export const navSections: NavSection[] = [
4747
title: 'Functions',
4848
items: [
4949
{ id: 'functions-overview', label: 'Overview', href: '/docs/functions' },
50-
{ id: 'functions-date', label: 'date', href: '/docs/functions/date' },
51-
{ id: 'functions-math', label: 'math', href: '/docs/functions/math' },
52-
{ id: 'functions-text', label: 'text', href: '/docs/functions/text' },
50+
{
51+
id: 'functions-date',
52+
label: 'date',
53+
href: '/docs/functions/date',
54+
children: [
55+
{ id: 'functions-date-add', label: 'add', href: '/docs/functions/date/add' },
56+
{ id: 'functions-date-day', label: 'day', href: '/docs/functions/date/day' },
57+
{ id: 'functions-date-diff', label: 'diff', href: '/docs/functions/date/diff' },
58+
{ id: 'functions-date-format', label: 'format', href: '/docs/functions/date/format' },
59+
{ id: 'functions-date-hour', label: 'hour', href: '/docs/functions/date/hour' },
60+
{ id: 'functions-date-minute', label: 'minute', href: '/docs/functions/date/minute' },
61+
{ id: 'functions-date-month', label: 'month', href: '/docs/functions/date/month' },
62+
{ id: 'functions-date-now', label: 'now', href: '/docs/functions/date/now' },
63+
{ id: 'functions-date-second', label: 'second', href: '/docs/functions/date/second' },
64+
{ id: 'functions-date-year', label: 'year', href: '/docs/functions/date/year' },
65+
],
66+
},
67+
{
68+
id: 'functions-math',
69+
label: 'math',
70+
href: '/docs/functions/math',
71+
children: [
72+
{ id: 'functions-math-abs', label: 'abs', href: '/docs/functions/math/abs' },
73+
{ id: 'functions-math-avg', label: 'avg', href: '/docs/functions/math/avg' },
74+
{ id: 'functions-math-ceil', label: 'ceil', href: '/docs/functions/math/ceil' },
75+
{ id: 'functions-math-count', label: 'count', href: '/docs/functions/math/count' },
76+
{ id: 'functions-math-floor', label: 'floor', href: '/docs/functions/math/floor' },
77+
{ id: 'functions-math-max', label: 'max', href: '/docs/functions/math/max' },
78+
{ id: 'functions-math-min', label: 'min', href: '/docs/functions/math/min' },
79+
{ id: 'functions-math-power', label: 'power', href: '/docs/functions/math/power' },
80+
{ id: 'functions-math-round', label: 'round', href: '/docs/functions/math/round' },
81+
{ id: 'functions-math-sum', label: 'sum', href: '/docs/functions/math/sum' },
82+
],
83+
},
84+
{
85+
id: 'functions-text',
86+
label: 'text',
87+
href: '/docs/functions/text',
88+
children: [
89+
{ id: 'functions-text-concat', label: 'concat', href: '/docs/functions/text/concat' },
90+
{ id: 'functions-text-length', label: 'length', href: '/docs/functions/text/length' },
91+
{ id: 'functions-text-lower', label: 'lower', href: '/docs/functions/text/lower' },
92+
{ id: 'functions-text-substring', label: 'substring', href: '/docs/functions/text/substring' },
93+
{ id: 'functions-text-trim', label: 'trim', href: '/docs/functions/text/trim' },
94+
{ id: 'functions-text-upper', label: 'upper', href: '/docs/functions/text/upper' },
95+
],
96+
},
5397
],
5498
},
5599
];

src/pages/docs/functions/date.tsx

Lines changed: 0 additions & 108 deletions
This file was deleted.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import { Link } from 'react-router-dom';
2+
import { DocsLayout } from '../../docs-layout';
3+
import { RqlCodeBlock } from '../../components';
4+
5+
export function DateAddPage() {
6+
return (
7+
<DocsLayout>
8+
<div className="space-y-8">
9+
{/* Header with breadcrumb */}
10+
<div>
11+
<div className="text-sm text-text-muted mb-2">
12+
<Link to="/docs/functions/date" className="font-bold hover:text-primary-color">
13+
date
14+
</Link>
15+
{' module'}
16+
</div>
17+
<h1 className="text-3xl sm:text-4xl font-black tracking-tight mb-4">
18+
date::add
19+
</h1>
20+
<p className="text-lg text-text-secondary leading-relaxed">
21+
Add time to a date.
22+
</p>
23+
</div>
24+
25+
{/* Syntax */}
26+
<section>
27+
<h2 className="text-2xl font-black tracking-tight mb-4">Syntax</h2>
28+
<RqlCodeBlock code={`date::add(date_value, days: n)`} />
29+
</section>
30+
31+
{/* Parameters */}
32+
<section>
33+
<h2 className="text-2xl font-black tracking-tight mb-4">Parameters</h2>
34+
<div className="border-2 border-border-default">
35+
<table className="w-full">
36+
<thead className="bg-bg-tertiary">
37+
<tr>
38+
<th className="text-left p-3 font-bold">Name</th>
39+
<th className="text-left p-3 font-bold">Type</th>
40+
<th className="text-left p-3 font-bold">Description</th>
41+
</tr>
42+
</thead>
43+
<tbody>
44+
<tr className="border-t-2 border-border-default">
45+
<td className="p-3"><code>date_value</code></td>
46+
<td className="p-3">Date/Timestamp</td>
47+
<td className="p-3">The base date to add time to</td>
48+
</tr>
49+
<tr className="border-t-2 border-border-default">
50+
<td className="p-3"><code>days</code></td>
51+
<td className="p-3">Integer</td>
52+
<td className="p-3">Number of days to add (can be negative to subtract)</td>
53+
</tr>
54+
</tbody>
55+
</table>
56+
</div>
57+
</section>
58+
59+
{/* Return Value */}
60+
<section>
61+
<h2 className="text-2xl font-black tracking-tight mb-4">Return Value</h2>
62+
<p className="text-text-secondary">
63+
Returns a new date/timestamp with the specified time added.
64+
</p>
65+
</section>
66+
67+
{/* Examples */}
68+
<section>
69+
<h2 className="text-2xl font-black tracking-tight mb-4">Examples</h2>
70+
71+
<h3 className="text-lg font-bold mb-3">Calculate expiration date</h3>
72+
<RqlCodeBlock
73+
code={`from app.subscriptions
74+
extend { expires: date::add(start_date, days: 30) }`}
75+
/>
76+
77+
<h3 className="text-lg font-bold mt-6 mb-3">Add days to current date</h3>
78+
<RqlCodeBlock
79+
code={`from app.events
80+
extend { deadline: date::add(date::now(), days: 7) }`}
81+
/>
82+
83+
<h3 className="text-lg font-bold mt-6 mb-3">Subtract days</h3>
84+
<RqlCodeBlock
85+
code={`from app.records
86+
extend { one_week_ago: date::add(date::now(), days: -7) }`}
87+
/>
88+
</section>
89+
90+
{/* Related Functions */}
91+
<section>
92+
<h2 className="text-2xl font-black tracking-tight mb-4">Related Functions</h2>
93+
<div className="flex gap-3 flex-wrap">
94+
<Link to="/docs/functions/date/diff" className="text-primary-color hover:underline">
95+
date::diff
96+
</Link>
97+
<Link to="/docs/functions/date/now" className="text-primary-color hover:underline">
98+
date::now
99+
</Link>
100+
</div>
101+
</section>
102+
</div>
103+
</DocsLayout>
104+
);
105+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import { Link } from 'react-router-dom';
2+
import { DocsLayout } from '../../docs-layout';
3+
import { RqlCodeBlock } from '../../components';
4+
5+
export function DateDayPage() {
6+
return (
7+
<DocsLayout>
8+
<div className="space-y-8">
9+
{/* Header with breadcrumb */}
10+
<div>
11+
<div className="text-sm text-text-muted mb-2">
12+
<Link to="/docs/functions/date" className="font-bold hover:text-primary-color">
13+
date
14+
</Link>
15+
{' module'}
16+
</div>
17+
<h1 className="text-3xl sm:text-4xl font-black tracking-tight mb-4">
18+
date::day
19+
</h1>
20+
<p className="text-lg text-text-secondary leading-relaxed">
21+
Extract the day of the month from a date value.
22+
</p>
23+
</div>
24+
25+
{/* Syntax */}
26+
<section>
27+
<h2 className="text-2xl font-black tracking-tight mb-4">Syntax</h2>
28+
<RqlCodeBlock code={`date::day(date_value)`} />
29+
</section>
30+
31+
{/* Parameters */}
32+
<section>
33+
<h2 className="text-2xl font-black tracking-tight mb-4">Parameters</h2>
34+
<div className="border-2 border-border-default">
35+
<table className="w-full">
36+
<thead className="bg-bg-tertiary">
37+
<tr>
38+
<th className="text-left p-3 font-bold">Name</th>
39+
<th className="text-left p-3 font-bold">Type</th>
40+
<th className="text-left p-3 font-bold">Description</th>
41+
</tr>
42+
</thead>
43+
<tbody>
44+
<tr className="border-t-2 border-border-default">
45+
<td className="p-3"><code>date_value</code></td>
46+
<td className="p-3">Date/Timestamp</td>
47+
<td className="p-3">The date to extract the day from</td>
48+
</tr>
49+
</tbody>
50+
</table>
51+
</div>
52+
</section>
53+
54+
{/* Return Value */}
55+
<section>
56+
<h2 className="text-2xl font-black tracking-tight mb-4">Return Value</h2>
57+
<p className="text-text-secondary">
58+
Returns an integer from 1-31 representing the day of the month.
59+
</p>
60+
</section>
61+
62+
{/* Examples */}
63+
<section>
64+
<h2 className="text-2xl font-black tracking-tight mb-4">Examples</h2>
65+
66+
<h3 className="text-lg font-bold mb-3">Filter by first day of month</h3>
67+
<RqlCodeBlock
68+
code={`from app.logs
69+
filter date::day(timestamp) == 1`}
70+
/>
71+
72+
<h3 className="text-lg font-bold mt-6 mb-3">Extract day component</h3>
73+
<RqlCodeBlock
74+
code={`from app.events
75+
extend { day_of_month: date::day(created_at) }`}
76+
/>
77+
</section>
78+
79+
{/* Related Functions */}
80+
<section>
81+
<h2 className="text-2xl font-black tracking-tight mb-4">Related Functions</h2>
82+
<div className="flex gap-3 flex-wrap">
83+
<Link to="/docs/functions/date/year" className="text-primary-color hover:underline">
84+
date::year
85+
</Link>
86+
<Link to="/docs/functions/date/month" className="text-primary-color hover:underline">
87+
date::month
88+
</Link>
89+
<Link to="/docs/functions/date/format" className="text-primary-color hover:underline">
90+
date::format
91+
</Link>
92+
</div>
93+
</section>
94+
</div>
95+
</DocsLayout>
96+
);
97+
}

0 commit comments

Comments
 (0)