Skip to content

Commit

Permalink
feat(extension): re-introduce static release notes (#1671)
Browse files Browse the repository at this point in the history
  • Loading branch information
mchappell committed Jan 27, 2025
1 parent 21c72d5 commit a7e7d28
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
/* eslint-disable no-console */
import React, { useEffect, useState, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { Modal, Typography } from 'antd';
import { Button } from '@lace/common';
import styles from './Announcement.module.scss';
import { ExtensionUpdateData } from '@lib/scripts/types';
import DefaultReleaseNote from '@src/release-notes/default';
import { fetchNotes } from './ReleaseNotes';

const { Title, Text } = Typography;

Expand All @@ -16,8 +17,25 @@ interface AnnouncementProps {
}

export const Announcement = ({ visible, onConfirm, version, reason }: AnnouncementProps): React.ReactElement => {
const [releaseNotes, setReleaseNotes] = useState<string>('');
const { t } = useTranslation();

const loadReleaseNotes = useCallback(async () => {
let notes = '';
if (version) {
try {
notes = await fetchNotes(version);
} catch (error) {
console.log(error);
}
}
setReleaseNotes(notes);
}, [version]);

useEffect(() => {
loadReleaseNotes();
}, [version, loadReleaseNotes]);

return (
<Modal
centered
Expand All @@ -34,9 +52,7 @@ export const Announcement = ({ visible, onConfirm, version, reason }: Announceme
<Title level={3} className={styles.title}>
{t('announcement.title.text', { version })}
</Title>
<Text className={styles.description}>
<DefaultReleaseNote version={version} />
</Text>
<Text className={styles.description}>{releaseNotes}</Text>
</div>
</div>
<Button className={styles.button} onClick={onConfirm} block>
Expand Down
18 changes: 18 additions & 0 deletions apps/browser-extension-wallet/src/release-notes/1_19_0.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable camelcase */
import React from 'react';

const ReleaseNote_1_19_0 = (): React.ReactElement => (
<>
<p>This release contains a couple of exciting updates:</p>
<ul style={{ listStyleType: 'disc', margin: 0 }}>
<li>
<strong>DApp Explorer:</strong> Discover and connect with dApps directly from Lace.
</li>
<li>
<strong>Snappier UX:</strong> Improved performance with more local caching
</li>
</ul>
</>
);

export default ReleaseNote_1_19_0;
25 changes: 0 additions & 25 deletions apps/browser-extension-wallet/src/release-notes/default.tsx

This file was deleted.

0 comments on commit a7e7d28

Please sign in to comment.