-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFezGlyphPage.jsx
More file actions
303 lines (292 loc) · 10.1 KB
/
FezGlyphPage.jsx
File metadata and controls
303 lines (292 loc) · 10.1 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import {
ArrowLeftIcon,
TranslateIcon,
PenNibIcon,
NotebookIcon,
CopyIcon,
CheckIcon,
} from '@phosphor-icons/react';
import Seo from '../../components/Seo';
import { useToast } from '../../hooks/useToast';
import GenerativeArt from '../../components/GenerativeArt';
import BreadcrumbTitle from '../../components/BreadcrumbTitle';
const SHORTHAND_MAP = {
a: 'ᐱ',
b: 'ᗷ',
c: 'ᑕ',
d: 'ᗪ',
e: 'ᐦ',
f: 'ᖴ',
g: 'ᘏ',
h: 'ᕼ',
i: 'ᐃ',
j: 'ᒧ',
k: 'ᔘ',
l: 'ᐳ',
m: 'ᒄ',
n: 'ᓀ',
o: 'ᐤ',
p: 'ᐯ',
q: 'ᕟ',
r: 'ᕃ',
s: 'ᔆ',
t: 'ᑎ',
u: 'ᑌ',
v: 'ᐪ',
w: 'ᐎ',
x: 'ᕁ',
y: 'ᔅ',
z: 'ᙆ',
A: 'ᐱ',
B: 'ᗷ',
C: 'ᑕ',
D: 'ᗪ',
E: 'ᐦ',
F: 'ᖴ',
G: 'ᘏ',
H: 'ᕼ',
I: 'ᐃ',
J: 'ᒧ',
K: 'ᔘ',
L: 'ᐳ',
M: 'ᒄ',
N: 'ᓀ',
O: 'ᐤ',
P: 'ᐯ',
Q: 'ᕟ',
R: 'ᕃ',
S: 'ᔆ',
T: 'ᑎ',
U: 'ᑌ',
V: 'ᐪ',
W: 'ᐎ',
X: 'ᕁ',
Y: 'ᔅ',
Z: 'ᙆ',
1: 'ᐘ',
2: 'ᐙ',
3: 'ᐚ',
4: 'ᐛ',
5: 'ᐜ',
6: 'ᐝ',
7: 'ᐞ',
8: 'ᐟ',
9: 'ᐠ',
0: 'ᐡ',
' ': ' ',
'.': '᙮',
',': 'ᙵ',
'?': 'ᙶ',
'!': 'ᙷ',
};
const REVERSE_SHORTHAND_MAP = Object.fromEntries(
Object.entries(SHORTHAND_MAP).map(([key, value]) => [
value,
key.toLowerCase(),
]),
);
const FezGlyphPage = () => {
const { addToast } = useToast();
const [text, setText] = useState('');
const [shorthand, setShorthand] = useState('');
const [isCopied, setIsCopied] = useState(false);
const handleTextChange = (e) => {
const newText = e.target.value;
setText(newText);
const newShorthand = newText
.split('')
.map((char) => SHORTHAND_MAP[char] || char)
.join('');
setShorthand(newShorthand);
};
const handleShorthandChange = (e) => {
const newShorthand = e.target.value;
setShorthand(newShorthand);
const newText = newShorthand
.split('')
.map((char) => REVERSE_SHORTHAND_MAP[char] || char)
.join('');
setText(newText);
};
const handleSymbolClick = (char, symbol) => {
const newShorthand = shorthand + symbol;
setShorthand(newShorthand);
// Find the reverse mapping for the symbol.
// Note: char passed here is the key from SHORTHAND_MAP (e.g. 'a'), which is what we want.
// However, we need to respect the reverse logic: symbol -> char.
// Since we know the pair (char, symbol), we can just append char.
// But let's stick to the reverse map to be safe and consistent with typing.
const mappedChar = REVERSE_SHORTHAND_MAP[symbol] || char;
setText(text + mappedChar);
};
const handleCopy = async () => {
if (!shorthand) return;
try {
await navigator.clipboard.writeText(shorthand);
setIsCopied(true);
addToast({
title: 'Success',
message: 'FezGlyph copied to clipboard',
type: 'success',
});
setTimeout(() => setIsCopied(false), 2000);
} catch (err) {
addToast({
title: 'Error',
message: 'Failed to copy',
type: 'error',
});
}
};
return (
<div className="min-h-screen bg-[#050505] text-white selection:bg-emerald-500/30 font-sans">
<Seo
title="FezGlyph | Fezcodex"
description="Transform text into the cryptic Fezcodex symbolic cipher."
keywords={[
'Fezcodex',
'fezglyph',
'symbols',
'cipher',
'converter',
'runes',
]}
/>
<div className="mx-auto max-w-7xl px-6 py-24 md:px-12">
<header className="mb-20">
<Link
to="/apps"
className="mb-8 inline-flex items-center gap-2 text-xs font-mono text-gray-500 hover:text-white transition-colors uppercase tracking-widest"
>
<ArrowLeftIcon weight="bold" />
<span>Applications</span>
</Link>
<div className="flex flex-col md:flex-row md:items-end justify-between gap-12">
<div className="space-y-4">
<BreadcrumbTitle
title="FezGlyph"
slug="fezglyph"
variant="brutalist"
/>
<p className="text-xl text-gray-400 max-w-2xl font-light leading-relaxed">
Proprietary symbolic cipher. Encrypt plaintext into the
geometric Fezcodex rune system.
</p>
</div>
</div>
</header>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-12 mb-12">
<div className="relative border border-white/10 bg-white/[0.02] p-8 rounded-sm group overflow-hidden">
<div className="absolute inset-0 opacity-5 pointer-events-none">
<GenerativeArt seed="TEXT_INPUT" className="w-full h-full" />
</div>
<h3 className="font-mono text-[10px] font-bold text-gray-500 uppercase tracking-widest mb-6 flex items-center gap-2">
<NotebookIcon weight="fill" className="text-emerald-500" />
Plaintext_Input
</h3>
<textarea
value={text}
onChange={handleTextChange}
className="w-full h-64 bg-black/40 border border-white/5 p-6 font-mono text-xl text-gray-300 focus:border-emerald-500 focus:outline-none transition-all rounded-sm resize-none scrollbar-hide"
placeholder="Type your message here..."
/>
</div>
<div className="relative border border-white/10 bg-white/[0.02] p-8 rounded-sm group overflow-hidden">
<div className="absolute inset-0 opacity-5 pointer-events-none">
<GenerativeArt seed="SYMBOL_OUTPUT" className="w-full h-full" />
</div>
<div className="flex items-center justify-between mb-6">
<h3 className="font-mono text-[10px] font-bold text-gray-500 uppercase tracking-widest flex items-center gap-2">
<PenNibIcon weight="fill" className="text-emerald-500" />
FezGlyph_Output
</h3>
<button
onClick={handleCopy}
disabled={!shorthand}
className="flex items-center gap-2 text-[10px] font-mono font-bold uppercase tracking-widest text-emerald-500 hover:text-emerald-400 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
>
{isCopied ? (
<>
<CheckIcon weight="bold" />
<span>Copied</span>
</>
) : (
<>
<CopyIcon weight="bold" />
<span>Copy</span>
</>
)}
</button>
</div>
<textarea
value={shorthand}
onChange={handleShorthandChange}
className="w-full h-64 bg-black/40 border border-white/5 p-6 font-mono text-2xl text-emerald-400 focus:border-emerald-500 focus:outline-none transition-all rounded-sm resize-none scrollbar-hide"
placeholder="ᐱᐦᗆᐤᗪ..."
/>
</div>
</div>
{/* Legend */}
<div className="border border-white/10 bg-white/[0.02] p-8 rounded-sm">
<h3 className="font-mono text-[10px] font-bold text-gray-500 uppercase tracking-widest mb-6 flex items-center gap-2">
<TranslateIcon weight="fill" className="text-emerald-500" />
Symbol_Legend
</h3>
<div className="grid grid-cols-2 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 gap-4">
{Object.entries(SHORTHAND_MAP)
.filter(([k]) => k.length === 1 && /[a-z0-9]/.test(k))
.map(([char, symbol]) => (
<button
key={char}
onClick={() => handleSymbolClick(char, symbol)}
className="flex items-center justify-between p-3 border border-white/5 bg-black/20 rounded-sm hover:bg-emerald-500/10 hover:border-emerald-500/50 transition-all cursor-pointer group"
>
<span className="font-mono text-gray-400 group-hover:text-emerald-400 transition-colors">
{char}
</span>
<span className="text-emerald-400 text-xl">{symbol}</span>
</button>
))}
</div>
</div>
{/* About Section */}
<div className="mt-12 border border-white/10 bg-white/[0.02] p-8 rounded-sm">
<h3 className="font-playfairDisplay text-lg font-bold text-gray-300 mb-6 flex items-center gap-2">
<NotebookIcon weight="fill" className="text-emerald-500" />
About FezGlyph
</h3>
<div className="prose prose-invert max-w-none font-arvo">
<p className="text-gray-400 font-light leading-relaxed mb-4">
The symbols used in <strong>FezGlyph</strong> are technically
known as <strong>Canadian Aboriginal Syllabics</strong>. Their
inclusion here is purely for visual and aesthetic purposes within
this digital art project, and we intend absolutely no disrespect
toward the Indigenous communities, their histories, or the sacred
nature of their scripts.
</p>
<ul className="list-disc pl-5 space-y-2 text-gray-400 font-light">
<li>
<strong>Origin:</strong> Developed in the 1840s by James Evans
in collaboration with Indigenous speakers.
</li>
<li>
<strong>Usage:</strong> A family of writing systems used by
several Indigenous peoples in Canada (such as the Cree, Ojibwe,
and Inuit).
</li>
<li>
<strong>Context:</strong> While used here as a simple
substitution cipher for their geometric aesthetic, in reality,
they form a syllabary where each symbol represents a specific
sound combination (like "ma", "ni", "po").
</li>
</ul>
</div>
</div>{' '}
</div>
</div>
);
};
export default FezGlyphPage;