Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Date format (#44)
Browse files Browse the repository at this point in the history
* add: version 1.2.8

* new: change how to print date + customisation summary

Co-authored-by: cgi-bin <[email protected]>
  • Loading branch information
sven-hash and cgi-bin authored Jan 8, 2023
1 parent 751fa58 commit 7673866
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 86 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pastenym",
"version": "1.2.6",
"version": "1.2.8",
"homepage": "http://pastenym.ch/",
"private": true,
"main": "index.js",
Expand Down
126 changes: 43 additions & 83 deletions src/components/SuccessUrlId.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import * as React from 'react'

/*
import { styled } from '@mui/material/styles';
import ArrowForwardIosSharpIcon from '@mui/icons-material/ArrowForwardIosSharp';
import MuiAccordion from '@mui/material/Accordion';
import MuiAccordionSummary from '@mui/material/AccordionSummary';
import MuiAccordionDetails from '@mui/material/AccordionDetails';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
*/
import CheckCircleIcon from '@mui/icons-material/CheckCircle'
import Alert from '@mui/joy/Alert'
import IconButton from '@mui/joy/IconButton'
Expand All @@ -19,36 +10,6 @@ import CopyToClipBoard from './CopyToClipboard'

const SERVER_NAME = process.env.SERVER_NAME || 'https://pastenym.ch'

/*
const Accordion = styled((props) => (
<MuiAccordion disableGutters elevation={0} sx={{ backgroundColor: "blue" }} {...props} />
))(({ theme }) => ({
backgroundColor: "success",
}));
const AccordionSummary = styled((props) => (
<MuiAccordionSummary
expandIcon={<ArrowForwardIosSharpIcon sx={{ fontSize: '0.9rem' }} />}
sx={{ backgroundColor: "blue" }}
{...props}
/>
))(({ theme }) => ({
flexDirection: 'row-reverse',
'& .MuiAccordionSummary-expandIconWrapper.Mui-expanded': {
transform: 'rotate(90deg)',
},
'& .MuiAccordionSummary-content': {
marginLeft: theme.spacing(1),
},
}));
const AccordionDetails = styled((props) => (
<MuiAccordionDetails sx={{ backgroundColor: 'blue' }} {...props} />
))(({ theme }) => ({
padding: theme.spacing(2),
}));
*/

class SuccessUrlId extends React.Component {
constructor(props) {
super(props)
Expand All @@ -57,9 +18,14 @@ class SuccessUrlId extends React.Component {
url: SERVER_NAME + '/#/' + this.props.urlId.url_id,
key: this.props.encKey,
urlId: this.props.urlId.url_id,
urlWithKey: this.props.encKey && this.props.encKey.length > 0 ?
SERVER_NAME + '/#/' + this.props.urlId.url_id + '&key=' + this.props.encKey
: undefined,
urlWithKey:
this.props.encKey && this.props.encKey.length > 0
? SERVER_NAME +
'/#/' +
this.props.urlId.url_id +
'&key=' +
this.props.encKey
: undefined,
copyToClipboardButton: 'Copy to clipboard',
copyToClipboardTooltipOpen: false,
ipfs: this.props.urlId.ipfs,
Expand All @@ -86,56 +52,50 @@ class SuccessUrlId extends React.Component {
}
>
<div>
<Typography fontWeight="lg" mt={0.25} fontSize="13px">
Text saved!
<Typography fontWeight="lg" mt={0.25} fontSize="16px">
<strong>Text saved!</strong>
</Typography>
<Typography
level="body"
fontSize="13px"
sx={{ opacity: 0.8, wordBreak: 'break-word' }}
>
sx={{ opacity: 0.8, wordBreak: 'break-word',color: 'black' }}
>
Your text is accessible using this link:{' '}
<Link
href={this.state.urlWithKey ? this.state.urlWithKey : this.state.url}
href={
this.state.urlWithKey
? this.state.urlWithKey
: this.state.url
}
title="Go to your newly created paste!"
>
{this.state.urlWithKey ? this.state.urlWithKey : this.state.url}
{this.state.urlWithKey
? this.state.urlWithKey
: this.state.url}
</Link>
<CopyToClipBoard textToCopy={this.state.urlWithKey ? this.state.urlWithKey : this.state.url} />
<CopyToClipBoard
textToCopy={
this.state.urlWithKey
? this.state.urlWithKey
: this.state.url
}
/>
{this.state.urlWithKey ? (
/* Accordion WIP
<Accordion>
<AccordionSummary expandIcon={<ExpandMoreIcon />} >
<Typography>Or separately...</Typography>
</AccordionSummary>
<AccordionDetails>
<Typography>
Using this link:{' '}
<Link
href={this.state.url}
title="Go to your newly created paste!"
>
{this.state.url}
</Link>
<CopyToClipBoard textToCopy={this.state.url} />
and this key: <b>{this.state.key}</b>{' '}
<CopyToClipBoard textToCopy={this.state.key} />.
</Typography>
</AccordionDetails>
</Accordion>
*/
<details>
<summary>Or separately...</summary>
<p>
Using this link:{' '}
<Link
href={this.state.url}
title="Go to your newly created paste!"
>
{this.state.url}
</Link>
<CopyToClipBoard textToCopy={this.state.url} />
and this key: <b>{this.state.key}</b>{' '}
<CopyToClipBoard textToCopy={this.state.key} />.
<details style={{ color: 'black' }}>
<summary>
<strong>Or separately...</strong>
</summary>
<p style={{marginLeft: "13px", marginTop:"-0.2em", marginBottom: "-0.2em"}}>
Using this link:{' '}
<Link
href={this.state.url}
title="Go to your newly created paste!"
>
{this.state.url}
</Link>
<CopyToClipBoard textToCopy={this.state.url} />
and this key: <b>{this.state.key}</b>{' '}
<CopyToClipBoard textToCopy={this.state.key} />
</p>
</details>
) : (
Expand Down
9 changes: 7 additions & 2 deletions src/components/TextStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TextStats extends React.Component {
render() {
return (
<Box sx={{ display: 'inline-block' }}>
{console.log(new Date(this.props.created_on).toLocaleString())}
<Typography
level="body2"
startDecorator={
Expand All @@ -28,8 +29,12 @@ class TextStats extends React.Component {
? `Views: ` + this.props.num_view + ` - `
: ''}
{'Created on: ' +
new Date(this.props.created_on).toLocaleString()
}
new Date(this.props.created_on).toLocaleString(navigator.language,{
day: "2-digit",
month: "2-digit",
year: "2-digit",
})
}
</Typography>

{this.props.is_ipfs ? ' - ' : ''}
Expand Down

0 comments on commit 7673866

Please sign in to comment.