Undo some accidental changes
This commit is contained in:
parent
b124705bfd
commit
06888b8ebc
|
@ -196,7 +196,7 @@
|
||||||
"expired": false,
|
"expired": false,
|
||||||
"expires_at": "2022-03-12T01:33:18.000Z",
|
"expires_at": "2022-03-12T01:33:18.000Z",
|
||||||
"id": "AHHue67gF2JDqCQGhc",
|
"id": "AHHue67gF2JDqCQGhc",
|
||||||
"multiple": true,
|
"multiple": false,
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"title": "Regular emoji 😍 ",
|
"title": "Regular emoji 😍 ",
|
||||||
|
|
|
@ -33,8 +33,8 @@ const shortDateFormatOptions = {
|
||||||
|
|
||||||
const SECOND = 1000;
|
const SECOND = 1000;
|
||||||
const MINUTE = 1000 * 60;
|
const MINUTE = 1000 * 60;
|
||||||
const HOUR = 1000 * 60 * 60;
|
const HOUR = 1000 * 60 * 60;
|
||||||
const DAY = 1000 * 60 * 60 * 24;
|
const DAY = 1000 * 60 * 60 * 24;
|
||||||
|
|
||||||
const MAX_DELAY = 2147483647;
|
const MAX_DELAY = 2147483647;
|
||||||
|
|
||||||
|
@ -160,12 +160,12 @@ class RelativeTimestamp extends React.Component {
|
||||||
_scheduleNextUpdate() {
|
_scheduleNextUpdate() {
|
||||||
clearTimeout(this._timer);
|
clearTimeout(this._timer);
|
||||||
|
|
||||||
const { timestamp } = this.props;
|
const { timestamp } = this.props;
|
||||||
const delta = (new Date(timestamp)).getTime() - this.state.now;
|
const delta = (new Date(timestamp)).getTime() - this.state.now;
|
||||||
const unitDelay = getUnitDelay(selectUnits(delta));
|
const unitDelay = getUnitDelay(selectUnits(delta));
|
||||||
const unitRemainder = Math.abs(delta % unitDelay);
|
const unitRemainder = Math.abs(delta % unitDelay);
|
||||||
const updateInterval = 1000 * 10;
|
const updateInterval = 1000 * 10;
|
||||||
const delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
|
const delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
|
||||||
|
|
||||||
this._timer = setTimeout(() => {
|
this._timer = setTimeout(() => {
|
||||||
this.setState({ now: Date.now() });
|
this.setState({ now: Date.now() });
|
||||||
|
@ -175,7 +175,7 @@ class RelativeTimestamp extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const { timestamp, intl, year, futureDate, ...textProps } = this.props;
|
const { timestamp, intl, year, futureDate, ...textProps } = this.props;
|
||||||
|
|
||||||
const date = new Date(timestamp);
|
const date = new Date(timestamp);
|
||||||
const relativeTime = futureDate ? timeRemainingString(intl, date, this.state.now) : timeAgoString(intl, date, this.state.now, year);
|
const relativeTime = futureDate ? timeRemainingString(intl, date, this.state.now) : timeAgoString(intl, date, this.state.now, year);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -18,9 +18,9 @@ const messages = defineMessages({
|
||||||
* These get embedded into the build, but only in this chunk, so it's okay.
|
* These get embedded into the build, but only in this chunk, so it's okay.
|
||||||
*/
|
*/
|
||||||
const MOCK_STATUSES: any[] = [
|
const MOCK_STATUSES: any[] = [
|
||||||
require('soapbox/__fixtures__/pleroma-status-with-poll-with-emojis.json'),
|
|
||||||
require('soapbox/__fixtures__/pleroma-status-with-poll.json'),
|
require('soapbox/__fixtures__/pleroma-status-with-poll.json'),
|
||||||
require('soapbox/__fixtures__/pleroma-status-vertical-video-without-metadata.json'),
|
require('soapbox/__fixtures__/pleroma-status-vertical-video-without-metadata.json'),
|
||||||
|
require('soapbox/__fixtures__/pleroma-status-with-poll-with-emojis.json'),
|
||||||
require('soapbox/__fixtures__/pleroma-quote-of-quote-post.json'),
|
require('soapbox/__fixtures__/pleroma-quote-of-quote-post.json'),
|
||||||
require('soapbox/__fixtures__/truthsocial-status-with-external-video.json'),
|
require('soapbox/__fixtures__/truthsocial-status-with-external-video.json'),
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,44 +1,30 @@
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Stack } from 'soapbox/components/ui';
|
|
||||||
import { Poll as PollEntity, PollOption as PollOptionEntity } from 'soapbox/types/entities';
|
import { Poll as PollEntity, PollOption as PollOptionEntity } from 'soapbox/types/entities';
|
||||||
|
|
||||||
interface IPollPreview {
|
interface IPollPreview {
|
||||||
poll: PollEntity,
|
poll: PollEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// {/* <li key={index}>
|
|
||||||
// <label className={classNames('poll__text', { selectable: !showResults })}>
|
|
||||||
// <input
|
|
||||||
// name='vote-options'
|
|
||||||
// type={poll.multiple ? 'checkbox' : 'radio'}
|
|
||||||
// disabled
|
|
||||||
// />
|
|
||||||
|
|
||||||
// <span className={classNames('poll__input', { checkbox: poll.multiple })} />
|
|
||||||
|
|
||||||
// <span dangerouslySetInnerHTML={{ __html: option.title_emojified }} />
|
|
||||||
// </label>
|
|
||||||
// </li> */}
|
|
||||||
|
|
||||||
const PollPreview: React.FC<IPollPreview> = ({ poll }) => {
|
const PollPreview: React.FC<IPollPreview> = ({ poll }) => {
|
||||||
const renderOption = (option: PollOptionEntity, index: number) => {
|
const renderOption = (option: PollOptionEntity, index: number) => {
|
||||||
const showResults = poll.voted || poll.expired;
|
const showResults = poll.voted || poll.expired;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<label className='rounded-tl-md rounded-tr-md relative border p-4 flex flex-col cursor-pointer md:pl-4 md:pr-6 md:grid md:grid-cols-3 focus:outline-none'>
|
<li key={index}>
|
||||||
<span className='flex items-center text-sm'>
|
<label className={classNames('poll__text', { selectable: !showResults })}>
|
||||||
<input type='radio' name='pricing-plan' value='Startup' className='h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500' aria-labelledby='pricing-plans-0-label' aria-describedby='pricing-plans-0-description-0 pricing-plans-0-description-1' />
|
<input
|
||||||
<span id='pricing-plans-0-label' className='ml-3 font-medium'>Startup</span>
|
name='vote-options'
|
||||||
</span>
|
type={poll.multiple ? 'checkbox' : 'radio'}
|
||||||
<span id='pricing-plans-0-description-0' className='ml-6 pl-1 text-sm md:ml-0 md:pl-0 md:text-center'>
|
disabled
|
||||||
<span className='font-medium'>$29 / mo</span>
|
/>
|
||||||
<span>($290 / yr)</span>
|
|
||||||
</span>
|
<span className={classNames('poll__input', { checkbox: poll.multiple })} />
|
||||||
<span id='pricing-plans-0-description-1' className='ml-6 pl-1 text-sm md:ml-0 md:pl-0 md:text-right'>Up to 5 active job postings</span>
|
|
||||||
</label>
|
<span dangerouslySetInnerHTML={{ __html: option.title_emojified }} />
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,9 +33,11 @@ const PollPreview: React.FC<IPollPreview> = ({ poll }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<div className='poll'>
|
||||||
{poll.options.map((option, i) => renderOption(option, i))}
|
<ul>
|
||||||
</Stack>
|
{poll.options.map((option, i) => renderOption(option, i))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue