-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathindex.tsx
150 lines (138 loc) · 5.21 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import { fs } from '@janhq/core'
import { Button, Input, ScrollArea, Switch } from '@janhq/joi'
import { useAtom, useAtomValue } from 'jotai'
import { FolderOpenIcon } from 'lucide-react'
import posthog from 'posthog-js'
import { toaster } from '@/containers/Toast'
import { usePath } from '@/hooks/usePath'
import { janDataFolderPathAtom } from '@/helpers/atoms/AppConfig.atom'
import { productAnalyticAtom } from '@/helpers/atoms/Setting.atom'
const Privacy = () => {
/**
* Clear logs
* @returns
*/
const clearLogs = async () => {
try {
await fs.rm(`file://logs`)
} catch (err) {
console.error('Error clearing logs: ', err)
}
toaster({
title: 'Logs cleared',
description: 'All logs have been cleared.',
type: 'success',
})
}
const janDataFolderPath = useAtomValue(janDataFolderPathAtom)
const { onRevealInFinder } = usePath()
const [productAnalytic, setProductAnalytic] = useAtom(productAnalyticAtom)
return (
<ScrollArea className="h-full w-full px-4">
<div className="mb-4 mt-8 rounded-xl bg-[hsla(var(--tertiary-bg))] px-4 py-2 text-[hsla(var(--text-secondary))]">
<p>
We prioritize your control over your data. Learn more about our
<a
href="https://jan.ai/docs/privacy"
target="_blank"
className="text-[hsla(var(--app-link))]"
>
Privacy Policy.
</a>
</p>
<br />
<p>
To make Jan better, we need to understand how it’s used - but only if
you choose to help. You can change your Jan Analytics settings
anytime.
</p>
<br />
<p>
{`Your choice to opt-in or out doesn't change our core privacy promises:`}
</p>
<ul className="list-inside list-disc pl-4">
<li>Your chats are never read</li>
<li>No personal information is collected</li>
<li>No accounts or logins required</li>
<li>We don’t access your files</li>
<li>Your chat history and settings stay on your device</li>
</ul>
</div>
<div className="block w-full py-4">
{/* Analytic */}
<div className="flex w-full flex-col justify-between gap-x-20 gap-y-4 border-b border-[hsla(var(--app-border))] py-4 first:pt-0 last:border-none sm:flex-row sm:items-center">
<div className="space-y-1">
<div className="flex gap-x-2">
<h6 className="font-semibold capitalize">Analytics</h6>
</div>
<p className="font-medium leading-relaxed text-[hsla(var(--text-secondary))]">
By opting in, you help us make Jan better by sharing anonymous
data, like feature usage and user counts. Your chats and personal
information are never collected.
</p>
</div>
<div className="flex-shrink-0">
<Switch
checked={productAnalytic}
onChange={(e) => {
if (e.target.checked) {
posthog.opt_in_capturing()
} else {
posthog.capture('user_opt_out', { timestamp: new Date() })
posthog.opt_out_capturing()
}
setProductAnalytic(e.target.checked)
}}
/>
</div>
</div>
{/* Logs */}
<div className="flex w-full flex-col items-start justify-between gap-4 border-b border-[hsla(var(--app-border))] py-4 first:pt-0 last:border-none sm:flex-row">
<div className="space-y-1">
<div className="flex gap-x-2">
<h6 className="font-semibold capitalize">Logs</h6>
</div>
<p className="font-medium leading-relaxed text-[hsla(var(--text-secondary))]">
Open App Logs and Cortex Logs.
</p>
</div>
<div className="flex items-center gap-x-3">
<div className="relative">
<Input
data-testid="jan-data-folder-input"
value={janDataFolderPath + '/logs'}
className="w-full pr-8 sm:w-[240px]"
disabled
/>
<FolderOpenIcon
size={16}
className="absolute right-2 top-1/2 z-10 -translate-y-1/2 cursor-pointer"
onClick={() => onRevealInFinder('Logs')}
/>
</div>
</div>
</div>
{/* Clear log */}
<div className="flex w-full flex-col items-start justify-between gap-4 border-b border-[hsla(var(--app-border))] py-4 first:pt-0 last:border-none sm:flex-row">
<div className="flex-shrink-0 space-y-1">
<div className="flex gap-x-2">
<h6 className="font-semibold capitalize">Clear logs</h6>
</div>
<p className="font-medium leading-relaxed text-[hsla(var(--text-secondary))]">
Clear all logs from Jan app.
</p>
</div>
<Button
data-testid="clear-logs"
theme="destructive"
variant="soft"
onClick={clearLogs}
>
Clear
</Button>
</div>
</div>
</ScrollArea>
)
}
export default Privacy