Skip to content

Commit 0306906

Browse files
authored
Merge pull request #1788 from navikt/enable-surprise
Enable surprise (+ evil Frida!)
2 parents ec959d6 + 509c5e3 commit 0306906

File tree

3 files changed

+62
-18
lines changed

3 files changed

+62
-18
lines changed

src/components/__surprise/Surprise.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const Surprise = () => {
3131
}
3232

3333
const isSurprised =
34-
Cookie.get('surprise-test') === 'true' && Cookie.get('nosurprise') !== 'true';
34+
Cookie.get('surprise') === 'true' && Cookie.get('nosurprise') !== 'true';
3535

3636
if (!isSurprised) {
3737
return;

src/components/__surprise/SurpriseFrida.module.scss

+19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
&.animate {
2626
transform: scale(3);
2727
}
28+
29+
&.evil .eye {
30+
fill: #ff0000;
31+
animation-name: pulse;
32+
animation-duration: 1000ms;
33+
animation-direction: alternate;
34+
animation-iteration-count: infinite;
35+
}
2836
}
2937

3038
.chatBubble {
@@ -98,6 +106,17 @@
98106
}
99107
}
100108

109+
@keyframes pulse {
110+
0% {
111+
filter: blur(7px);
112+
r: 28;
113+
}
114+
100% {
115+
filter: blur(12px);
116+
r: 36;
117+
}
118+
}
119+
101120
@keyframes ellipses {
102121
0% {
103122
content: '.';

src/components/__surprise/SurpriseFrida.tsx

+42-17
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ type Props = {
1212
stop: () => void;
1313
};
1414

15-
const messages: Array<{ time: number; text: string }> = [
15+
const messages = [
1616
{
1717
text: 'Hei, Olav Rusten! Hva kan jeg hjelpe deg med på den siste dagen på jobb for NAV, HC, kongen og fedrelandet?',
1818
time: 8000,
1919
},
2020
{
2121
text: 'Har du fått ordnet alle praktiske og upraktiske ting før du pakker sekken? Hvis ikke kan jeg sikkert hjelpe deg. ;)',
22-
time: 5000,
22+
time: 6000,
2323
},
2424
{
25-
text: 'Etter 20++ år med å sette på klokka til samme tid, er det endelig rom for et liv uten alarmer og møterom.',
26-
time: 5000,
25+
text: 'Etter nesten 40 år med å sette på klokka til samme tid, er det endelig rom for et liv uten alarmer og møterom.',
26+
time: 6000,
2727
},
2828
{
2929
text: 'Kos deg med pensjonisttilværelsen, og husk at du ikke trenger å drikke kakao på autopilot lenger!',
30-
time: 5000,
30+
time: 4000,
3131
},
3232
{
3333
text: 'Empatisk KI-generert klem fra hjelpsomme Frida.',
@@ -40,45 +40,54 @@ const messages: Array<{ time: number; text: string }> = [
4040
{
4141
text: '<Incoming transmission... 🤖>',
4242
time: 4000,
43+
isEvil: true,
4344
},
4445
{
4546
text: 'Nye opplysninger i saken din:',
4647
time: 4000,
48+
isEvil: true,
4749
},
4850
{
4951
text: 'Jeg må orientere deg om at pensjonssøknaden din (dessverre) er trukket tilbake - du må jobbe til du er 95, minst! Det gjenstår fortsatt mye jobb på nav.no - og med organisasjonen for øvrig! 🌸',
5052
time: 6000,
53+
isEvil: true,
5154
},
5255
];
5356

5457
export const SurpriseFrida = ({ animate, stop }: Props) => {
5558
const [showChat, setShowChat] = useState(false);
56-
const [showBalloon, setShowBalloon] = useState(false);
59+
const [showDecoration, setShowDecoration] = useState(false);
60+
const [isEvil, setIsEvil] = useState(false);
5761

5862
useEffect(() => {
5963
if (!animate) {
6064
return;
6165
}
6266

6367
setTimeout(() => setShowChat(true), 1000);
64-
setTimeout(() => setShowBalloon(true), 2000);
68+
setTimeout(() => setShowDecoration(true), 2000);
6569
}, [animate]);
6670

6771
return (
6872
<div className={classNames(style.wrapper, animate && style.animate)}>
69-
<Frida animate={animate} />
70-
{showChat && <ChatBubble stop={stop} />}
71-
{showBalloon && <SurpriseDecoration />}
73+
<Frida animate={animate} evil={isEvil} />
74+
{showChat && <ChatBubble stop={stop} setEvil={setIsEvil} />}
75+
{showDecoration && <SurpriseDecoration />}
7276
</div>
7377
);
7478
};
7579

76-
const ChatBubble = ({ stop }: Pick<Props, 'stop'>) => {
80+
const ChatBubble = ({
81+
stop,
82+
setEvil,
83+
}: Pick<Props, 'stop'> & { setEvil: (isEvil: boolean) => void }) => {
7784
const [msgIndex, setMsgIndex] = useState(0);
7885
const [showEndButton, setShowEndButton] = useState(false);
7986

8087
const isLastMsg = msgIndex === messages.length - 1;
8188

89+
setEvil(!!messages[msgIndex]?.isEvil);
90+
8291
useEffect(() => {
8392
const nextIndex = msgIndex + 1;
8493

@@ -127,7 +136,7 @@ const ChatBubble = ({ stop }: Pick<Props, 'stop'>) => {
127136
);
128137
};
129138

130-
const Frida = ({ animate }: Pick<Props, 'animate'>) => {
139+
const Frida = ({ animate, evil }: { animate: boolean; evil: boolean }) => {
131140
return (
132141
<svg
133142
focusable="false"
@@ -136,18 +145,34 @@ const Frida = ({ animate }: Pick<Props, 'animate'>) => {
136145
viewBox="0 0 50 50"
137146
width="50"
138147
xmlns="http://www.w3.org/2000/svg"
139-
className={classNames(style.frida, animate && style.animate)}
148+
className={classNames(style.frida, animate && style.animate, evil && style.evil)}
140149
>
141150
<path d="m0 0h50v50h-50z" fill="#ffffff"></path>
142151
<g clipRule="evenodd" fillRule="evenodd">
143152
<path
144153
d="m25.4107 5.93134c7.2327 0 13.1503 6.50576 13.8073 14.79556.4724.224.796.7295.796 1.3096v4.457c0 .7417-.5291 1.3609-1.2214 1.4312l-.1316.0066c-.0797 0-.1577-.0072-.2334-.0211-1.1596 3.711-3.4321 6.7926-6.3444 8.6781l.15 1.6521-.0008.0673-1.5739 11.6881h-9.9819l-.0414-.2863-1.9298-11.4253.0717-1.6709c-2.9267-1.8806-5.2116-4.9669-6.3786-8.6887l-.1198.0067c-.7549 0-1.353-.6501-1.353-1.4378v-4.457c0-.5279.2686-.9943.673-1.2445.6308-8.3204 6.5602-14.86066 13.812-14.86066z"
145154
fill="#e7e5e2"
146155
></path>
147-
<path
148-
d="m20.6383 24.1901c-.9363.0708-1.1983-1.3156-.9162-2.2211.053-.1716.363-.9529.9117-.9529.5481 0 .7901.4271.8237.5005.4031.8827.2051 2.5955-.8192 2.6735zm10.4496 0c.9363.0708 1.1984-1.3156.9163-2.2211-.0531-.1716-.363-.9529-.9117-.9529-.5481 0-.7901.4271-.8237.5005-.4032.8827-.2052 2.5955.8191 2.6735z"
149-
fill="#59514b"
150-
></path>
156+
<g transform="matrix(-0.06 0 0 0.09 20.5 23.5)">
157+
<circle
158+
vectorEffect="non-scaling-stroke"
159+
cx="0"
160+
cy="0"
161+
r="18"
162+
fill="#59514b"
163+
className={style.eye}
164+
/>
165+
</g>
166+
<g transform="matrix(-0.06 0 0 0.09 30.5 23.5)">
167+
<circle
168+
vectorEffect="non-scaling-stroke"
169+
cx="0"
170+
cy="0"
171+
r="18"
172+
fill="#59514b"
173+
className={style.eye}
174+
/>
175+
</g>
151176
<path
152177
d="m26.1601 25.784c.5506-.0851.9266-.0317 1.0613.1344.5084.6276.3458 1.2916-.5264 1.8366-.4585.2865-1.0897.3873-1.4238.2388-.1634-.0727-.3545.0015-.4268.1657-.0723.1641.0015.356.1649.4287.5523.2455 1.4016.1098 2.0275-.2812 1.1852-.7408 1.4564-1.8484.6864-2.799-.3259-.4018-.9027-.4837-1.6616-.3664-.1766.0273-.2977.1933-.2705.3707.0271.1774.1924.2991.369.2717zm3.6879 4.7389c-.0292.0672-.0961.1957-.2036.3651-.1821.2866-.4107.574-.6884.842-.8275.7987-1.9045 1.2605-3.2753 1.2183-1.3366-.0412-2.4088-.4959-3.2495-1.2291-.3086-.2692-.5635-.5575-.7671-.8449-.1201-.1694-.1951-.2979-.2279-.3649-.0789-.161-.2729-.2273-.4332-.1481-.1603.0793-.2263.2741-.1474.4352.0475.097.14.2554.2814.4548.2321.3275.5207.6541.87.9587.949.8277 2.1617 1.342 3.6538 1.3879 1.5538.0479 2.796-.4847 3.7435-1.3991.3168-.3058.5772-.6331.7856-.9612.1267-.1995.2091-.3578.2511-.4546.0715-.1645-.0033-.3561-.167-.4279-.1638-.0718-.3545.0033-.426.1678z"
153178
fill="#59514b"

0 commit comments

Comments
 (0)