|
1 | 1 | import React from "react"; |
2 | | -import Link from "next/link"; |
3 | | -import { Button, Text } from "@mantine/core"; |
4 | | -import styled from "styled-components"; |
5 | | -import { UpgradeContent } from "../../../modals/UpgradeModal"; |
6 | | - |
7 | | -const StyledNotSupported = styled.div` |
8 | | - position: relative; |
9 | | - display: flex; |
10 | | - flex-direction: column; |
11 | | - align-items: center; |
12 | | - justify-content: center; |
13 | | - width: 100%; |
14 | | - height: 100%; |
15 | | - overflow: hidden; |
16 | | -
|
17 | | - .glowing { |
18 | | - position: relative; |
19 | | - min-width: 700px; |
20 | | - height: 550px; |
21 | | - margin: -150px; |
22 | | - transform-origin: right; |
23 | | - animation: colorChange 5s linear infinite; |
24 | | - } |
25 | | -
|
26 | | - .glowing:nth-child(even) { |
27 | | - transform-origin: left; |
28 | | - } |
29 | | -
|
30 | | - @keyframes colorChange { |
31 | | - 0% { |
32 | | - filter: hue-rotate(0deg); |
33 | | - transform: rotate(0deg); |
34 | | - } |
35 | | - 100% { |
36 | | - filter: hue-rotate(360deg); |
37 | | - transform: rotate(360deg); |
38 | | - } |
39 | | - } |
40 | | -
|
41 | | - .glowing span { |
42 | | - --i: 1; |
43 | | - position: absolute; |
44 | | - top: calc(80px * var(--i)); |
45 | | - left: calc(80px * var(--i)); |
46 | | - bottom: calc(80px * var(--i)); |
47 | | - right: calc(80px * var(--i)); |
48 | | - } |
49 | | -
|
50 | | - .glowing span::before { |
51 | | - content: ""; |
52 | | - position: absolute; |
53 | | - top: 50%; |
54 | | - left: -8px; |
55 | | - width: 15px; |
56 | | - height: 15px; |
57 | | - background: #f00; |
58 | | - border-radius: 50%; |
59 | | - } |
60 | | -
|
61 | | - .glowing span:nth-child(3n + 1)::before { |
62 | | - background: rgba(134, 255, 0, 1); |
63 | | - box-shadow: |
64 | | - 0 0 20px rgba(134, 255, 0, 1), |
65 | | - 0 0 40px rgba(134, 255, 0, 1), |
66 | | - 0 0 60px rgba(134, 255, 0, 1), |
67 | | - 0 0 80px rgba(134, 255, 0, 1), |
68 | | - 0 0 0 8px rgba(134, 255, 0, 0.1); |
69 | | - } |
70 | | -
|
71 | | - .glowing span:nth-child(3n + 2)::before { |
72 | | - background: rgba(255, 214, 0, 1); |
73 | | - box-shadow: |
74 | | - 0 0 20px rgba(255, 214, 0, 1), |
75 | | - 0 0 40px rgba(255, 214, 0, 1), |
76 | | - 0 0 60px rgba(255, 214, 0, 1), |
77 | | - 0 0 80px rgba(255, 214, 0, 1), |
78 | | - 0 0 0 8px rgba(255, 214, 0, 0.1); |
| 2 | +import { Anchor, Button, Image, Overlay, Stack, Text } from "@mantine/core"; |
| 3 | +import styled, { keyframes } from "styled-components"; |
| 4 | +import useConfig from "../../../../store/useConfig"; |
| 5 | +import { useModal } from "../../../../store/useModal"; |
| 6 | + |
| 7 | +const shineEffect = keyframes` |
| 8 | + 0% { |
| 9 | + transform: translateX(-120%) rotate(25deg); |
| 10 | + opacity: 0.5; |
79 | 11 | } |
80 | | -
|
81 | | - .glowing span:nth-child(3n + 3)::before { |
82 | | - background: rgba(0, 226, 255, 1); |
83 | | - box-shadow: |
84 | | - 0 0 20px rgba(0, 226, 255, 1), |
85 | | - 0 0 40px rgba(0, 226, 255, 1), |
86 | | - 0 0 60px rgba(0, 226, 255, 1), |
87 | | - 0 0 80px rgba(0, 226, 255, 1), |
88 | | - 0 0 0 8px rgba(0, 226, 255, 0.1); |
| 12 | + 5% { |
| 13 | + opacity: 0.5; |
| 14 | + transform: translateX(-80%) rotate(25deg); |
89 | 15 | } |
90 | | -
|
91 | | - .glowing span:nth-child(3n + 1) { |
92 | | - animation: animate 10s alternate infinite; |
| 16 | + 70% { |
| 17 | + transform: translateX(80%) rotate(25deg); |
| 18 | + opacity: 0.5; |
93 | 19 | } |
94 | | -
|
95 | | - .glowing span:nth-child(3n + 2) { |
96 | | - animation: animate-reverse 3s alternate infinite; |
| 20 | + 80% { |
| 21 | + transform: translateX(120%) rotate(25deg); |
| 22 | + opacity: 0; |
97 | 23 | } |
98 | | -
|
99 | | - .glowing span:nth-child(3n + 3) { |
100 | | - animation: animate 8s alternate infinite; |
| 24 | + 100% { |
| 25 | + transform: translateX(120%) rotate(25deg); |
| 26 | + opacity: 0; |
101 | 27 | } |
| 28 | +`; |
102 | 29 |
|
103 | | - @keyframes animate { |
104 | | - 0% { |
105 | | - transform: rotate(180deg); |
106 | | - } |
107 | | - 50% { |
108 | | - transform: rotate(0deg); |
109 | | - } |
110 | | - 100% { |
111 | | - transform: rotate(360deg); |
112 | | - } |
113 | | - } |
114 | | -
|
115 | | - @keyframes animate-reverse { |
116 | | - 0% { |
117 | | - transform: rotate(360deg); |
118 | | - } |
119 | | -
|
120 | | - 50% { |
121 | | - transform: rotate(180deg); |
122 | | - } |
| 30 | +const ShiningButton = styled.div` |
| 31 | + position: relative; |
| 32 | + overflow: hidden; |
| 33 | + display: inline-block; |
| 34 | + border-radius: 0.5rem; |
| 35 | + z-index: 10; |
123 | 36 |
|
124 | | - 100% { |
125 | | - transform: rotate(0deg); |
126 | | - } |
| 37 | + &::before { |
| 38 | + content: ""; |
| 39 | + position: absolute; |
| 40 | + top: -50%; |
| 41 | + left: -50%; |
| 42 | + width: 200%; |
| 43 | + height: 200%; |
| 44 | + background: linear-gradient( |
| 45 | + to right, |
| 46 | + rgba(255, 255, 255, 0) 0%, |
| 47 | + rgba(255, 255, 255, 0) 35%, |
| 48 | + rgba(255, 255, 255, 0.5) 50%, |
| 49 | + rgba(255, 255, 255, 0) 65%, |
| 50 | + rgba(255, 255, 255, 0) 100% |
| 51 | + ); |
| 52 | + transform: translateX(-120%) rotate(25deg); |
| 53 | + z-index: 20; |
| 54 | + pointer-events: none; |
| 55 | + animation: ${shineEffect} 4s ease-out infinite; |
| 56 | + transition: transform 0.2s ease-out; |
127 | 57 | } |
128 | 58 | `; |
129 | 59 |
|
130 | | -const StyledContent = styled.div` |
131 | | - position: absolute; |
132 | | - left: 0; |
133 | | - top: 0; |
134 | | - width: 100%; |
135 | | - height: 100%; |
136 | | - display: flex; |
137 | | - flex-direction: column; |
138 | | - align-items: center; |
139 | | - justify-content: center; |
140 | | - z-index: 1; |
141 | | -`; |
142 | | - |
143 | 60 | export const NotSupported = () => { |
| 61 | + const darkmodeEnabled = useConfig(state => state.darkmodeEnabled); |
| 62 | + const setVisible = useModal(state => state.setVisible); |
| 63 | + |
144 | 64 | return ( |
145 | | - <StyledNotSupported> |
146 | | - <StyledContent> |
147 | | - <UpgradeContent direction="column-reverse" maw="550" /> |
148 | | - <Text c="dimmed" maw="400" my="lg" ta="center"> |
149 | | - JSON Crack is unable to support data of this size. <br /> |
150 | | - Try the new editor for better performance. |
| 65 | + <Overlay |
| 66 | + backgroundOpacity={0.8} |
| 67 | + color={darkmodeEnabled ? "gray" : "rgb(226, 240, 243)"} |
| 68 | + blur="1.5" |
| 69 | + center |
| 70 | + > |
| 71 | + <Stack maw="60%" align="center" justify="center" gap="sm"> |
| 72 | + <Image src="https://todiagram.com/logo.svg" alt="Unsupported" w={72} h={72} /> |
| 73 | + <Text fz="48" fw={600} c="bright"> |
| 74 | + Time to upgrade! |
151 | 75 | </Text> |
152 | | - <Link |
153 | | - rel="noopener" |
154 | | - href="https://todiagram.com/editor?utm_source=jsoncrack&utm_medium=data_limit" |
155 | | - target="_blank" |
156 | | - passHref |
157 | | - > |
158 | | - <Button size="lg" color="teal" radius="xl"> |
159 | | - Upgrade now |
| 76 | + <Text ta="center" size="lg" fw={500} c="gray" maw="600"> |
| 77 | + This diagram is too large and not supported at JSON Crack. |
| 78 | + <br /> |
| 79 | + Try{" "} |
| 80 | + <Anchor inherit c="teal" fw="500" onClick={() => setVisible("UpgradeModal", true)}> |
| 81 | + ToDiagram |
| 82 | + </Anchor>{" "} |
| 83 | + for larger diagrams and more features. |
| 84 | + </Text> |
| 85 | + <ShiningButton style={{ marginTop: "16px", position: "relative" }}> |
| 86 | + <Button |
| 87 | + component="a" |
| 88 | + href="https://todiagram.com/editor?utm_source=jsoncrack&utm_medium=data_limit" |
| 89 | + rel="noopener" |
| 90 | + size="lg" |
| 91 | + w="200" |
| 92 | + target="_blank" |
| 93 | + color="teal" |
| 94 | + > |
| 95 | + Try now → |
160 | 96 | </Button> |
161 | | - </Link> |
162 | | - </StyledContent> |
163 | | - |
164 | | - <div className="glowing"> |
165 | | - <span></span> |
166 | | - <span></span> |
167 | | - <span></span> |
168 | | - </div> |
169 | | - </StyledNotSupported> |
| 97 | + </ShiningButton> |
| 98 | + </Stack> |
| 99 | + </Overlay> |
170 | 100 | ); |
171 | 101 | }; |
0 commit comments