From 0fbdd8fd01affde5efb831e7ef96997cb937d529 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 13 Feb 2020 18:30:36 -0500 Subject: [PATCH] wire up skylink input --- .../src/components/HomeUpload/HomeUpload.js | 14 ++++++++++++-- .../sia-skynet/src/components/Mailing/Mailing.js | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/sia-skynet/src/components/HomeUpload/HomeUpload.js b/packages/sia-skynet/src/components/HomeUpload/HomeUpload.js index 82d91b1c..54db6493 100644 --- a/packages/sia-skynet/src/components/HomeUpload/HomeUpload.js +++ b/packages/sia-skynet/src/components/HomeUpload/HomeUpload.js @@ -58,6 +58,16 @@ export default class HomeUpload extends Component { }); }; + handleSkylink = (event) => { + event.preventDefault(); + + const skylink = event.target.skylink.value.replace('sia://', ''); + + if(skylink.length === 46) { + window.open(`/${event.target.skylink.value}`, '_blank'); + } + } + render() { return ( @@ -104,8 +114,8 @@ export default class HomeUpload extends Component {

Have a Skylink?

Enter the ID to retrieve the file

-
- + + diff --git a/packages/sia-skynet/src/components/Mailing/Mailing.js b/packages/sia-skynet/src/components/Mailing/Mailing.js index 3b5257ca..9fc1dda8 100644 --- a/packages/sia-skynet/src/components/Mailing/Mailing.js +++ b/packages/sia-skynet/src/components/Mailing/Mailing.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react' +import React from 'react' import MailchimpSubscribe from 'react-mailchimp-subscribe' import classNames from 'classnames'