1
1
import { useState } from "react" ;
2
+ import Page from "@/components/Page" ;
2
3
3
4
import { useAuth } from "@/lib/auth" ;
4
- import { createCheckoutSession , goToBillingPortal } from "@/lib/db" ;
5
+ import { goToBillingPortal } from "@/lib/db" ;
5
6
import DashboardShell from "@/components/DashboardShell" ;
6
7
import Box from "@/components/Box" ;
8
+ const SettingsTable = ( { stripeRole, children } ) => (
9
+ < div className = "mt-5" >
10
+ < div className = "flex justify-between" >
11
+ < h4 className = "text-lg" > Nastavení</ h4 >
12
+ < span className = "text-lg font-bold" > Předplatné: { stripeRole } </ span >
13
+ </ div >
14
+ < div className = "flex p-4 pt-0" > { children } </ div >
15
+ </ div >
16
+ ) ;
17
+ const FeedbackUsage = ( ) => (
18
+ < section className = "grid grid-cols-2 text-left gap-6" >
19
+ < div className = "w-full col-span-2 sm:col-span-1 p-6 border-2 border-black dark:border-white" >
20
+ < h4 className = "font-bold text-lg" > Feedback</ h4 >
21
+ < p className = "text-lg" > ∞</ p >
22
+ < p className = "text-lg " > 10,000 limit</ p >
23
+ </ div >
24
+ < div className = "w-full col-span-2 sm:col-span-1 p-6 border-2 border-black dark:border-white" >
25
+ < h4 className = "font-bold text-lg" > Feedback</ h4 >
26
+ < p className = "text-lg" > ∞</ p >
27
+ < p className = "text-lg" > 10,000 limit</ p >
28
+ </ div >
29
+ </ section >
30
+ ) ;
7
31
8
32
const Account = ( ) => {
9
33
const { user, signout } = useAuth ( ) ;
@@ -13,16 +37,34 @@ const Account = () => {
13
37
return (
14
38
< DashboardShell >
15
39
< Box >
40
+ < div className = "block m-auto text-center" >
41
+ < img
42
+ className = "w-32 rounded-full border-2 border-black dark:border-white m-auto"
43
+ src = { user ? user . photoUrl : "null" }
44
+ />
45
+ < h1 className = "font-bold text-2xl mt-2" >
46
+ { user ? user . name : "None" }
47
+ </ h1 >
48
+ < h3 > { user ? user . email : "None" } </ h3 >
49
+ < SettingsTable stripeRole = { user ?. stripeRole } />
50
+ < FeedbackUsage />
51
+ < p className = "text-md text-left pt-6" >
52
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
53
+ Pellentesque pretium lectus id turpis. Duis risus. Aliquam erat
54
+ volutpat. Nullam feugiat, turpis at pulvinar vulputate, erat libero
55
+ tristique tellus, nec bibendum odio risus sit amet ante.
56
+ </ p >
57
+ </ div >
58
+ </ Box >
59
+ < div className = "flex justify-end mt-4" >
16
60
< button
17
61
className = " bg-white text-black active:bg-pink-600 border-2 border-black dark:border-white dark:bg-black dark:text-white px-6 py-3 outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
18
- type = "button"
19
62
onClick = { ( ) => {
20
- setCheckoutLoading ( true ) ;
21
- createCheckoutSession ( user . uid ) ;
63
+ setBillingLoading ( true ) ;
64
+ goToBillingPortal ( ) ;
22
65
} }
23
66
>
24
- { " " }
25
- { isCheckoutLoading ? (
67
+ { isBillingLoading ? (
26
68
< div className = "flex items-center" >
27
69
< svg
28
70
xmlns = "http://www.w3.org/2000/svg"
@@ -53,32 +95,24 @@ const Account = () => {
53
95
</ div >
54
96
) : (
55
97
< div className = "flex items-center" >
56
- < svg
57
- xmlns = "http://www.w3.org/2000/svg"
58
- width = "24"
59
- height = "24"
60
- viewBox = "0 0 24 24"
61
- className = "h-5 w-5 mr-3 fill-current"
62
- >
63
- < path d = "M3.414,13.778L2,15.192l4.949,2.121l2.122,4.95l1.414-1.414l-0.707-3.536l3.313-3.313l3.61,7.704l1.339-1.339l-1.19-10.123 l2.828-2.829c0.781-0.781,0.781-2.047,0-2.828c-0.781-0.781-2.048-0.781-2.828,0l-2.903,2.903L3.824,6.297L2.559,7.563l7.644,3.67 l-3.253,3.253L3.414,13.778z" > </ path >
64
- </ svg >
65
- < p > Upgradovat plán na startovač</ p >
98
+ < p > Nastavení platby</ p >
66
99
</ div >
67
100
) }
68
101
</ button >
69
102
< button
70
103
className = " bg-white text-black active:bg-pink-600 border-2 border-black dark:border-white dark:bg-black dark:text-white px-6 py-3 outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
71
- onClick = { ( ) => {
72
- setBillingLoading ( true ) ;
73
- goToBillingPortal ( ) ;
74
- } }
104
+ onClick = { ( ) => signout ( ) }
75
105
>
76
- View Billing Portal
106
+ Odhlásit
77
107
</ button >
78
- < button onClick = { ( ) => signout ( ) } > Log Out</ button >
79
- </ Box >
108
+ </ div >
80
109
</ DashboardShell >
81
110
) ;
82
111
} ;
112
+ const AccountPage = ( ) => (
113
+ < Page name = "Účet" path = "/account" >
114
+ < Account />
115
+ </ Page >
116
+ ) ;
83
117
84
- export default Account ;
118
+ export default AccountPage ;
0 commit comments