KeyValueArray.tsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. import React, { useContext, useEffect, useState } from "react";
  2. import {
  3. GetFinalVariablesFunction,
  4. KeyValueArrayField,
  5. KeyValueArrayFieldState,
  6. PopulatedEnvGroup,
  7. } from "../types";
  8. import sliders from "../../../assets/sliders.svg";
  9. import upload from "../../../assets/upload.svg";
  10. import styled, { keyframes } from "styled-components";
  11. import useFormField from "../hooks/useFormField";
  12. import Modal from "../../../main/home/modals/Modal";
  13. import LoadEnvGroupModal from "../../../main/home/modals/LoadEnvGroupModal";
  14. import EnvEditorModal from "../../../main/home/modals/EnvEditorModal";
  15. import { hasSetValue } from "../utils";
  16. import _, { isObject, omit } from "lodash";
  17. import Helper from "components/form-components/Helper";
  18. import Heading from "components/form-components/Heading";
  19. import Loading from "components/Loading";
  20. import api from "shared/api";
  21. import { Context } from "shared/Context";
  22. interface Props extends KeyValueArrayField {
  23. id: string;
  24. }
  25. const KeyValueArray: React.FC<Props> = (props) => {
  26. const { state, setState, variables } = useFormField<KeyValueArrayFieldState>(
  27. props.id,
  28. {
  29. initState: () => {
  30. let values = props.value[0];
  31. const normalValues = Object.entries(values?.normal || {});
  32. values = omit(values, ["normal", "synced", "build"]);
  33. return {
  34. values: hasSetValue(props)
  35. ? ([...Object.entries(values), ...normalValues]?.map(([k, v]) => {
  36. return { key: k, value: v };
  37. }) as any[])
  38. : [],
  39. showEnvModal: false,
  40. showEditorModal: false,
  41. synced_env_groups: props.settings?.options?.enable_synced_env_groups
  42. ? null
  43. : [],
  44. };
  45. },
  46. }
  47. );
  48. const { currentProject } = useContext(Context);
  49. // If the variable includes normal it means that the form corresponds to an old job template version
  50. // The "normal" keyword doesn't exist for applications as well as the enable_synced_env_groups setting.
  51. // This is why we have to check if the form corresponds to a job or not.
  52. const enableSyncedEnvGroups = props.variable.includes("normal")
  53. ? !!props.settings?.options?.enable_synced_env_groups
  54. : true;
  55. useEffect(() => {
  56. if (hasSetValue(props) && !Array.isArray(state?.synced_env_groups)) {
  57. const values = props.value[0];
  58. // console.log(values);
  59. const envGroups = values?.synced || [];
  60. const promises = Promise.all(
  61. envGroups.map(async (envGroup: any) => {
  62. const res = await api.getEnvGroup(
  63. "<token>",
  64. {},
  65. {
  66. id: currentProject.id,
  67. cluster_id: variables.clusterId,
  68. namespace: variables.namespace,
  69. name: envGroup?.name,
  70. version: envGroup.version,
  71. }
  72. );
  73. return res.data;
  74. })
  75. );
  76. promises.then((populatedEnvGroups) => {
  77. setState(() => ({
  78. synced_env_groups: Array.isArray(populatedEnvGroups)
  79. ? populatedEnvGroups
  80. : [],
  81. }));
  82. });
  83. }
  84. }, [
  85. props.value[0],
  86. variables?.clusterId,
  87. variables?.namespace,
  88. currentProject?.id,
  89. ]);
  90. if (state == undefined) return <></>;
  91. if (!Array.isArray(state.synced_env_groups) && enableSyncedEnvGroups) {
  92. return <Loading />;
  93. }
  94. const parseEnv = (src: any, options: any) => {
  95. const debug = Boolean(options && options.debug);
  96. const obj = {} as Record<string, string>;
  97. const NEWLINE = "\n";
  98. const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/;
  99. const RE_NEWLINES = /\\n/g;
  100. const NEWLINES_MATCH = /\n|\r|\r\n/;
  101. // convert Buffers before splitting into lines and processing
  102. src
  103. .toString()
  104. .split(NEWLINES_MATCH)
  105. .forEach(function (line: any, idx: any) {
  106. // matching "KEY' and 'VAL' in 'KEY=VAL'
  107. const keyValueArr = line.match(RE_INI_KEY_VAL);
  108. // matched?
  109. if (keyValueArr != null) {
  110. const key = keyValueArr[1];
  111. // default undefined or missing values to empty string
  112. let val = keyValueArr[2] || "";
  113. const end = val.length - 1;
  114. const isDoubleQuoted = val[0] === '"' && val[end] === '"';
  115. const isSingleQuoted = val[0] === "'" && val[end] === "'";
  116. // if single or double quoted, remove quotes
  117. if (isSingleQuoted || isDoubleQuoted) {
  118. val = val.substring(1, end);
  119. // if double quoted, expand newlines
  120. if (isDoubleQuoted) {
  121. val = val.replace(RE_NEWLINES, NEWLINE);
  122. }
  123. } else {
  124. // remove surrounding whitespace
  125. val = val.trim();
  126. }
  127. obj[key] = val;
  128. } else if (debug) {
  129. console.log(
  130. `did not match key and value when parsing line ${idx + 1}: ${line}`
  131. );
  132. }
  133. });
  134. return obj;
  135. };
  136. const readFile = (env: string) => {
  137. let envObj = parseEnv(env, null);
  138. let push = true;
  139. for (let key in envObj) {
  140. for (var i = 0; i < state.values.length; i++) {
  141. let existingKey = state.values[i]["key"];
  142. if (key === existingKey) {
  143. state.values[i]["value"] = envObj[key];
  144. push = false;
  145. }
  146. }
  147. if (push) {
  148. setState((prev) => {
  149. return {
  150. values: [...prev.values, { key, value: envObj[key] }],
  151. };
  152. });
  153. }
  154. }
  155. };
  156. const renderEditorModal = () => {
  157. if (state.showEditorModal) {
  158. return (
  159. <Modal
  160. onRequestClose={() =>
  161. setState(() => {
  162. return { showEditorModal: false };
  163. })
  164. }
  165. width="60%"
  166. height="80%"
  167. >
  168. <EnvEditorModal
  169. closeModal={() =>
  170. setState(() => {
  171. return { showEditorModal: false };
  172. })
  173. }
  174. setEnvVariables={(envFile: string) => readFile(envFile)}
  175. />
  176. </Modal>
  177. );
  178. }
  179. };
  180. const getProcessedValues = (
  181. objectArray: { key: string; value: string }[]
  182. ): any => {
  183. let obj = {} as any;
  184. objectArray?.forEach(({ key, value }) => {
  185. obj[key] = value;
  186. });
  187. return obj;
  188. };
  189. const renderEnvModal = () => {
  190. if (state.showEnvModal) {
  191. return (
  192. <Modal
  193. onRequestClose={() =>
  194. setState(() => {
  195. return { showEnvModal: false };
  196. })
  197. }
  198. width="800px"
  199. height="542px"
  200. >
  201. <LoadEnvGroupModal
  202. existingValues={getProcessedValues(state.values)}
  203. enableSyncedEnvGroups={enableSyncedEnvGroups}
  204. syncedEnvGroups={state.synced_env_groups}
  205. namespace={variables.namespace}
  206. clusterId={variables.clusterId}
  207. closeModal={() =>
  208. setState(() => {
  209. return {
  210. showEnvModal: false,
  211. };
  212. })
  213. }
  214. setSyncedEnvGroups={(value) => {
  215. setState((prev) => {
  216. return {
  217. synced_env_groups: [...(prev.synced_env_groups || []), value],
  218. };
  219. });
  220. }}
  221. setValues={(values) => {
  222. setState((prev) => {
  223. // Transform array to object similar on what we receive from setValues
  224. const prevValues = prev.values.reduce((acc, currentValue) => {
  225. acc[currentValue.key] = currentValue.value;
  226. return acc;
  227. }, {} as Record<string, string>);
  228. // Deconstruct the two records/objects inside one to merge their values (this will override the old duped vars too)
  229. // and convert the new object back to an array usable for the component
  230. const newValues = Object.entries({
  231. ...prevValues,
  232. ...values,
  233. })?.map(([k, v]) => {
  234. return {
  235. key: k,
  236. value: v,
  237. };
  238. });
  239. return {
  240. values: [...newValues],
  241. };
  242. });
  243. }}
  244. />
  245. </Modal>
  246. );
  247. }
  248. };
  249. const renderDeleteButton = (i: number) => {
  250. if (!props.isReadOnly) {
  251. return (
  252. <DeleteButton
  253. onClick={() => {
  254. state.values.splice(i, 1);
  255. setState((prev) => {
  256. return {
  257. values: prev.values
  258. .slice(0, i + 1)
  259. .concat(prev.values.slice(i + 1, prev.values.length)),
  260. };
  261. });
  262. }}
  263. >
  264. <i className="material-icons">cancel</i>
  265. </DeleteButton>
  266. );
  267. }
  268. };
  269. const renderHiddenOption = (hidden: boolean, i: number) => {
  270. if (props.secretOption && hidden) {
  271. return (
  272. <HideButton>
  273. <i className="material-icons">lock</i>
  274. </HideButton>
  275. );
  276. }
  277. };
  278. const checkOverridedKey = (key: string) => {
  279. const env_group = state.synced_env_groups.find(
  280. (env) => env?.variables && env?.variables[key]
  281. );
  282. if (env_group) {
  283. return (
  284. <Wrapper>
  285. <Helper color="#f5cb42" style={{ marginLeft: "10px" }}>
  286. Overridden by the env group "{env_group?.name}"
  287. </Helper>
  288. </Wrapper>
  289. );
  290. }
  291. return null;
  292. };
  293. const renderInputList = () => {
  294. return (
  295. <>
  296. {state.values?.map((entry: any, i: number) => {
  297. // Preprocess non-string env values set via raw Helm values
  298. let { value } = entry;
  299. if (typeof value === "object") {
  300. value = JSON.stringify(value);
  301. } else if (typeof value === "number" || typeof value === "boolean") {
  302. value = value.toString();
  303. }
  304. return (
  305. <InputWrapper key={i}>
  306. <Input
  307. placeholder="ex: key"
  308. width="270px"
  309. value={entry.key}
  310. onChange={(e: any) => {
  311. e.persist();
  312. setState((prev) => {
  313. return {
  314. values: prev.values?.map((t, j) => {
  315. if (j == i) {
  316. return {
  317. ...t,
  318. key: e.target.value,
  319. };
  320. }
  321. return t;
  322. }),
  323. };
  324. });
  325. }}
  326. disabled={props.isReadOnly || value.includes("PORTERSECRET")}
  327. spellCheck={false}
  328. borderColor={
  329. checkOverridedKey(entry.key) ? "#f5cb42" : undefined
  330. }
  331. />
  332. <Spacer />
  333. <Input
  334. placeholder="ex: value"
  335. width="270px"
  336. value={value}
  337. onChange={(e: any) => {
  338. e.persist();
  339. setState((prev) => {
  340. return {
  341. values: prev.values?.map((t, j) => {
  342. if (j == i) {
  343. return {
  344. ...t,
  345. value: e.target.value,
  346. };
  347. }
  348. return t;
  349. }),
  350. };
  351. });
  352. }}
  353. disabled={props.isReadOnly || value.includes("PORTERSECRET")}
  354. type={value.includes("PORTERSECRET") ? "password" : "text"}
  355. spellCheck={false}
  356. />
  357. {renderDeleteButton(i)}
  358. {renderHiddenOption(value.includes("PORTERSECRET"), i)}
  359. {checkOverridedKey(entry.key)}
  360. </InputWrapper>
  361. );
  362. })}
  363. </>
  364. );
  365. };
  366. return (
  367. <>
  368. <StyledInputArray>
  369. <Label>{props.label}</Label>
  370. {state.values.length === 0 ? <></> : renderInputList()}
  371. {props.isReadOnly ? (
  372. <></>
  373. ) : (
  374. <InputWrapper>
  375. <AddRowButton
  376. onClick={() => {
  377. setState((prev) => {
  378. return {
  379. values: [...prev.values, { key: "", value: "" }],
  380. };
  381. });
  382. }}
  383. >
  384. <i className="material-icons">add</i> Add Row
  385. </AddRowButton>
  386. <Spacer />
  387. {variables.namespace && props.envLoader && (
  388. <LoadButton
  389. onClick={() =>
  390. setState((prev) => {
  391. return {
  392. showEnvModal: !prev.showEnvModal,
  393. };
  394. })
  395. }
  396. >
  397. <img src={sliders} /> Load from Env Group
  398. </LoadButton>
  399. )}
  400. {props.fileUpload && (
  401. <UploadButton
  402. onClick={() => {
  403. setState((prev) => {
  404. return {
  405. showEditorModal: true,
  406. };
  407. });
  408. }}
  409. >
  410. <img src={upload} /> Copy from File
  411. </UploadButton>
  412. )}
  413. </InputWrapper>
  414. )}
  415. {enableSyncedEnvGroups && !!state.synced_env_groups?.length && (
  416. <>
  417. <Heading>Synced Environment Groups</Heading>
  418. <Br />
  419. {state.synced_env_groups?.map((envGroup: any) => {
  420. return (
  421. <ExpandableEnvGroup
  422. key={envGroup?.name}
  423. envGroup={envGroup}
  424. onDelete={() => {
  425. setState((prev) => {
  426. const synced = prev.synced_env_groups?.filter(
  427. (env) => env.name !== envGroup.name
  428. );
  429. return {
  430. ...prev,
  431. synced_env_groups: synced,
  432. };
  433. });
  434. }}
  435. />
  436. );
  437. })}
  438. </>
  439. )}
  440. </StyledInputArray>
  441. {renderEnvModal()}
  442. {renderEditorModal()}
  443. </>
  444. );
  445. };
  446. export const getFinalVariablesForKeyValueArray: GetFinalVariablesFunction = (
  447. vars,
  448. props: KeyValueArrayField,
  449. state: KeyValueArrayFieldState
  450. ) => {
  451. if (!state) {
  452. return {
  453. [props.variable]: hasSetValue(props) ? props.value[0] : [],
  454. };
  455. }
  456. if (props.variable.includes("env")) {
  457. let obj = {
  458. normal: {},
  459. } as any;
  460. const rg = /(?:^|[^\\])(\\n)/g;
  461. const fixNewlines = (s: string) => {
  462. while (rg.test(s)) {
  463. s = s.replace(rg, (str) => {
  464. if (str.length == 2) return "\n";
  465. if (str[0] != "\\") return str[0] + "\n";
  466. return "\\n";
  467. });
  468. }
  469. return s;
  470. };
  471. const isNumber = (s: string) => {
  472. return !isNaN(!s ? NaN : Number(String(s).trim()));
  473. };
  474. state.values.forEach((entry: any, i: number) => {
  475. if (isNumber(entry.value)) {
  476. obj.normal[entry.key] = entry.value;
  477. } else {
  478. obj.normal[entry.key] = fixNewlines(entry.value);
  479. }
  480. });
  481. if (Array.isArray(props.value) && props.value[0]?.build) {
  482. obj.build = props.value[0].build;
  483. }
  484. if (state.synced_env_groups?.length) {
  485. obj.synced = state.synced_env_groups.map((envGroup) => ({
  486. name: envGroup?.name,
  487. version: envGroup?.version,
  488. keys: Object.entries(envGroup?.variables || {}).map(([key, val]) => ({
  489. name: key,
  490. secret: val.includes("PORTERSECRET"),
  491. })),
  492. }));
  493. }
  494. const variableContent = props.variable.split(".");
  495. let variable = props.variable;
  496. if (variable.includes("normal")) {
  497. variable = `${variableContent[0]}.${variableContent[1]}`;
  498. }
  499. return {
  500. [variable]: obj,
  501. };
  502. } else {
  503. let obj = {} as any;
  504. const rg = /(?:^|[^\\])(\\n)/g;
  505. const fixNewlines = (s: string) => {
  506. while (rg.test(s)) {
  507. s = s.replace(rg, (str) => {
  508. if (str.length == 2) return "\n";
  509. if (str[0] != "\\") return str[0] + "\n";
  510. return "\\n";
  511. });
  512. }
  513. return s;
  514. };
  515. const isNumber = (s: string) => {
  516. return !isNaN(!s ? NaN : Number(String(s).trim()));
  517. };
  518. state.values.forEach((entry: any, i: number) => {
  519. if (isNumber(entry.value)) {
  520. obj[entry.key] = entry.value;
  521. } else {
  522. obj[entry.key] = fixNewlines(entry.value);
  523. }
  524. });
  525. return {
  526. [props.variable]: obj,
  527. };
  528. }
  529. };
  530. export default KeyValueArray;
  531. const ExpandableEnvGroup: React.FC<{
  532. envGroup: PopulatedEnvGroup;
  533. onDelete: () => void;
  534. }> = ({ envGroup, onDelete }) => {
  535. const [isExpanded, setIsExpanded] = useState(false);
  536. return (
  537. <>
  538. <StyledCard>
  539. <Flex>
  540. <ContentContainer>
  541. <EventInformation>
  542. <EventName>{envGroup.name}</EventName>
  543. </EventInformation>
  544. </ContentContainer>
  545. <ActionContainer>
  546. <ActionButton onClick={() => onDelete()}>
  547. <span className="material-icons">delete</span>
  548. </ActionButton>
  549. <ActionButton onClick={() => setIsExpanded((prev) => !prev)}>
  550. <i className="material-icons">
  551. {isExpanded ? "arrow_drop_up" : "arrow_drop_down"}
  552. </i>
  553. </ActionButton>
  554. </ActionContainer>
  555. </Flex>
  556. {isExpanded && (
  557. <>
  558. <Buffer />
  559. {isObject(envGroup.variables) ? (
  560. <>
  561. {Object.entries(envGroup.variables || {})?.map(
  562. ([key, value], i: number) => {
  563. // Preprocess non-string env values set via raw Helm values
  564. if (typeof value === "object") {
  565. value = JSON.stringify(value);
  566. } else {
  567. value = String(value);
  568. }
  569. return (
  570. <InputWrapper key={i}>
  571. <Input
  572. placeholder="ex: key"
  573. width="270px"
  574. value={key}
  575. disabled
  576. />
  577. <Spacer />
  578. <Input
  579. placeholder="ex: value"
  580. width="270px"
  581. value={value}
  582. disabled
  583. type={
  584. value.includes("PORTERSECRET") ? "password" : "text"
  585. }
  586. />
  587. </InputWrapper>
  588. );
  589. }
  590. )}
  591. </>
  592. ) : (
  593. <NoVariablesTextWrapper>
  594. This env group has no variables yet
  595. </NoVariablesTextWrapper>
  596. )}
  597. <Br />
  598. </>
  599. )}
  600. </StyledCard>
  601. </>
  602. );
  603. };
  604. const Br = styled.div`
  605. width: 100%;
  606. height: 1px;
  607. `;
  608. const Buffer = styled.div`
  609. width: 100%;
  610. height: 10px;
  611. `;
  612. const Spacer = styled.div`
  613. width: 10px;
  614. height: 20px;
  615. `;
  616. const AddRowButton = styled.div`
  617. display: flex;
  618. align-items: center;
  619. width: 270px;
  620. font-size: 13px;
  621. color: #aaaabb;
  622. height: 32px;
  623. border-radius: 3px;
  624. cursor: pointer;
  625. background: #ffffff11;
  626. :hover {
  627. background: #ffffff22;
  628. }
  629. > i {
  630. color: #ffffff44;
  631. font-size: 16px;
  632. margin-left: 8px;
  633. margin-right: 10px;
  634. display: flex;
  635. align-items: center;
  636. justify-content: center;
  637. }
  638. `;
  639. const LoadButton = styled(AddRowButton)`
  640. background: none;
  641. border: 1px solid #ffffff55;
  642. > i {
  643. color: #ffffff44;
  644. font-size: 16px;
  645. margin-left: 8px;
  646. margin-right: 10px;
  647. display: flex;
  648. align-items: center;
  649. justify-content: center;
  650. }
  651. > img {
  652. width: 14px;
  653. margin-left: 10px;
  654. margin-right: 12px;
  655. }
  656. `;
  657. const UploadButton = styled(AddRowButton)`
  658. background: none;
  659. position: relative;
  660. margin-left: 10px;
  661. border: 1px solid #ffffff55;
  662. > i {
  663. color: #ffffff44;
  664. font-size: 16px;
  665. margin-left: 8px;
  666. margin-right: 10px;
  667. display: flex;
  668. align-items: center;
  669. justify-content: center;
  670. }
  671. > img {
  672. width: 14px;
  673. margin-left: 10px;
  674. margin-right: 12px;
  675. }
  676. `;
  677. const DeleteButton = styled.div`
  678. width: 15px;
  679. height: 15px;
  680. display: flex;
  681. align-items: center;
  682. margin-left: 8px;
  683. margin-top: -3px;
  684. justify-content: center;
  685. > i {
  686. font-size: 17px;
  687. color: #ffffff44;
  688. display: flex;
  689. align-items: center;
  690. justify-content: center;
  691. cursor: pointer;
  692. :hover {
  693. color: #ffffff88;
  694. }
  695. }
  696. `;
  697. const HideButton = styled(DeleteButton)`
  698. margin-top: -5px;
  699. > i {
  700. font-size: 19px;
  701. cursor: default;
  702. :hover {
  703. color: #ffffff44;
  704. }
  705. }
  706. `;
  707. const Wrapper = styled.div`
  708. margin-left: 5px;
  709. height: 20px;
  710. display: flex;
  711. align-items: center;
  712. margin-top: -7px;
  713. `;
  714. const InputWrapper = styled.div`
  715. display: flex;
  716. align-items: center;
  717. margin-top: 5px;
  718. `;
  719. type InputProps = {
  720. disabled?: boolean;
  721. width: string;
  722. borderColor?: string;
  723. };
  724. const Input = styled.input<InputProps>`
  725. outline: none;
  726. border: none;
  727. margin-bottom: 5px;
  728. font-size: 13px;
  729. background: #ffffff11;
  730. border: 1px solid
  731. ${(props) => (props.borderColor ? props.borderColor : "#ffffff55")};
  732. border-radius: 3px;
  733. width: ${(props) => (props.width ? props.width : "270px")};
  734. color: ${(props) => (props.disabled ? "#ffffff44" : "white")};
  735. padding: 5px 10px;
  736. height: 35px;
  737. `;
  738. const Label = styled.div`
  739. color: #ffffff;
  740. margin-bottom: 10px;
  741. `;
  742. const StyledInputArray = styled.div`
  743. margin-bottom: 15px;
  744. margin-top: 22px;
  745. `;
  746. const fadeIn = keyframes`
  747. from {
  748. opacity: 0;
  749. }
  750. to {
  751. opacity: 1;
  752. }
  753. `;
  754. const StyledCard = styled.div`
  755. border: 1px solid #ffffff44;
  756. background: #ffffff11;
  757. margin-bottom: 5px;
  758. border-radius: 8px;
  759. margin-top: 15px;
  760. padding: 10px 14px;
  761. overflow: hidden;
  762. font-size: 13px;
  763. animation: ${fadeIn} 0.5s;
  764. `;
  765. const Flex = styled.div`
  766. display: flex;
  767. height: 25px;
  768. align-items: center;
  769. justify-content: space-between;
  770. `;
  771. const ContentContainer = styled.div`
  772. display: flex;
  773. height: 40px;
  774. width: 100%;
  775. align-items: center;
  776. `;
  777. const EventInformation = styled.div`
  778. display: flex;
  779. flex-direction: column;
  780. justify-content: space-around;
  781. height: 100%;
  782. `;
  783. const EventName = styled.div`
  784. font-family: "Work Sans", sans-serif;
  785. font-weight: 500;
  786. color: #ffffff;
  787. `;
  788. const ActionContainer = styled.div`
  789. display: flex;
  790. align-items: center;
  791. white-space: nowrap;
  792. height: 100%;
  793. `;
  794. const ActionButton = styled.button`
  795. position: relative;
  796. border: none;
  797. background: none;
  798. color: white;
  799. padding: 5px;
  800. width: 30px;
  801. height: 30px;
  802. margin-left: 5px;
  803. display: flex;
  804. justify-content: center;
  805. align-items: center;
  806. border-radius: 50%;
  807. cursor: pointer;
  808. color: #aaaabb;
  809. border: 1px solid #ffffff00;
  810. :hover {
  811. background: #ffffff11;
  812. border: 1px solid #ffffff44;
  813. }
  814. > span {
  815. font-size: 20px;
  816. }
  817. `;
  818. const NoVariablesTextWrapper = styled.div`
  819. display: flex;
  820. align-items: center;
  821. justify-content: center;
  822. color: #ffffff99;
  823. `;