Skip to content

Allow to input valid border in case of failed getblockcount request #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ progress::-webkit-progress-value {
background: transparent !important;
}

.tag {
background: transparent !important;
}

.notification a:not(.button):not(.dropdown-item) {
text-decoration: none;
}
Expand Down Expand Up @@ -319,6 +323,11 @@ code {
background: #343942;
}

.tag {
background: transparent !important;
color: #adbac7 !important;
}

.notification.is-primary .subtitle {
color: #fff !important;
}
Expand Down
6 changes: 4 additions & 2 deletions src/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Home = ({
}) => {
const [formData, setFormData] = useState<FormData>({
spanStart: 0,
spanEnd: '',
spanEnd: nets[0].maxBlock !== 0 ? nets[0].maxBlock : '',
network: 0,
});

Expand Down Expand Up @@ -65,7 +65,7 @@ const Home = ({

const fetchBlocksInRange = async (retryIndex: number | null = null) => {
if (formData.spanStart === '' || formData.spanEnd === '' || formData.spanEnd < 0) return onModal('failed', 'Insert correct data');
if (formData.spanStart < 0 || formData.spanEnd < 0 || formData.spanStart > nets[formData.network].maxBlock || formData.spanEnd > nets[formData.network].maxBlock) return onModal('failed', 'Insert correct borders');
if (formData.spanStart < 0 || formData.spanEnd < 0 || ((formData.spanStart > nets[formData.network].maxBlock || formData.spanEnd > nets[formData.network].maxBlock) && nets[formData.network].maxBlock !== 0)) return onModal('failed', 'Insert correct borders');


if (retryIndex === null) {
Expand Down Expand Up @@ -134,6 +134,8 @@ const Home = ({
} catch (error: any) {
if (error.message.indexOf('showSaveFilePicker is not a function') !== -1) {
onModal('failed', 'Your current browser does not support this site\'s functionality. For the best experience, please use Chrome 86+ (recommended).', 'about');
} else if (error.message.indexOf('The user aborted a request.') !== -1) {
onModal('failed', 'Aborted by user.');
} else {
onModal('failed', error.message || 'Error occurred during block fetching.', (retryIndexTemp: number) => fetchBlocksInRange(+formData.spanStart + retryIndexTemp));
}
Expand Down