fix(account-store): Update fake data import for screenshots

This commit is contained in:
Ben Gotow 2016-06-01 15:55:21 -07:00
parent 5055ba59a9
commit 8860326065
2 changed files with 43 additions and 26 deletions

View file

@ -4,39 +4,47 @@ import OnboardingActions from './onboarding-actions';
const Steps = [
{
seen: false,
id: 'schedule',
title: 'Time is everything',
id: 'people',
title: 'Compose with context',
image: 'feature-people@2x.png',
description: 'Snooze emails to any time that suits you. Schedule emails to be sent later. With Nylas Pro, you are in th control of email spacetime.',
x: 80,
y: 4.9,
description: 'N1 shows you everything about your contacts right inside your inbox. See LinkedIn profiles, Twitter bios, and more.',
x: 97,
y: -1.9,
xDot: 93,
yDot: 4.9,
},
{
seen: false,
id: 'read-receipts',
title: 'Time is everything',
title: 'Track activity',
image: 'feature-snooze@2x.png',
description: 'Snooze emails to any time that suits you. Sechedule emails to be sent later. With Nylas Pro, you are in th control of email spacetime.',
x: 91,
y: 4.9,
description: "With activity tracking, you'll know as soon as someone reads your message. Sending to a group? We'll show which recipients opened your message, so you can follow up with precision.",
x: 10,
y: -1.9,
xDot: 14.6,
yDot: 4.9,
},
{
seen: false,
id: 'activity',
title: 'Track Activity',
id: 'snooze',
title: 'Time is everything',
image: 'feature-activity@2x.png',
description: 'Snooze emails to any time that suits you. Schedule emails to be sent later. With Nylas Pro, you are in th control of email spacetime.',
x: 12.9,
y: 17,
description: 'Snooze emails to any time that suits you. Schedule emails to be sent at the ideal time. N1 makes it easy to control the fabric of spacetime.',
x: 22,
y: 39.9,
xDot: 25,
yDot: 39.9,
},
{
seen: false,
id: 'mail-merge',
id: 'composer-power',
title: 'Composer Power',
image: 'feature-composer@2x.png',
description: 'Snooze emails to any time that suits you. Sechedule emails to be sent later. With Nylas Pro, you are in th control of email spacetime.',
x: 57,
y: 82,
description: "Use N1's powerful composer to embed calendar invitations, propose times to meet with recipients, insert templates, and more.",
x: 82.5,
y: 93,
xDot: 78.7,
yDot: 82.5,
},
];
@ -105,12 +113,12 @@ export default class TutorialPage extends React.Component {
key={step.id}
id={step.id}
className={`overlay ${seen.includes(step) ? 'seen' : ''} ${current === step ? 'expanded' : ''}`}
style={{left: `${step.x}%`, top: `${step.y}%`}}
style={{left: `${step.xDot}%`, top: `${step.yDot}%`}}
onMouseOver={this._onMouseOverOverlay}
>
<div
className="overlay-content"
style={{backgroundPosition: `${step.x - 3.0}% ${step.y - 3.0}%`}}
style={{backgroundPosition: `${step.x}% ${step.y}%`}}
>
</div>
</div>

View file

@ -272,7 +272,7 @@ class AccountStore extends NylasStore
@_caches = {}
labels = {}
labels = []
threads = []
messages = []
@ -286,8 +286,9 @@ class AccountStore extends NylasStore
account.aliases = []
account.name = "Nora"
account.provider = "gmail"
@_accounts.push(account)
@_tokens[account.id] = 'nope'
json = account.toJSON()
json.token = 'nope'
@addAccountFromJSON(json)
filenames = fs.readdirSync(path.join(dir, 'threads'))
for filename in filenames
@ -300,12 +301,18 @@ class AccountStore extends NylasStore
for m in threadMessages
m.accountId = account.id
for l in m.categories
l.accountId = account.id
for l in m.files
l.accountId = account.id
threadParticipants = threadParticipants.concat(m.participants())
threadLabels = threadLabels.concat(m.categories)
threadAttachment ||= m.files.length > 0
threadUnread ||= m.unread
threadParticipants = _.uniq threadParticipants, (p) -> p.email
threadLabels = _.uniq threadLabels, (l) -> l.id
labels = _.uniq labels.concat(threadLabels), (l) -> l.id
lastMsg = _.last(threadMessages)
thread = new Thread(
@ -315,7 +322,7 @@ class AccountStore extends NylasStore
subject: lastMsg.subject
lastMessageReceivedTimestamp: lastMsg.date
hasAttachment: threadAttachment
labels: threadLabels
categories: threadLabels
participants: threadParticipants
unread: threadUnread
snippet: lastMsg.snippet
@ -327,12 +334,14 @@ class AccountStore extends NylasStore
downloadsDir = path.join(dir, 'downloads')
if fs.existsSync(downloadsDir)
for filename in fs.readdirSync(downloadsDir)
fs.copySync(path.join(downloadsDir, filename), path.join(NylasEnv.getConfigDirPath(), 'downloads', filename))
destPath = path.join(NylasEnv.getConfigDirPath(), 'downloads', filename)
fs.removeSync(destPath) if fs.existsSync(destPath)
fs.copySync(path.join(downloadsDir, filename), destPath)
DatabaseStore.inTransaction (t) =>
Promise.all([
t.persistModel(account),
t.persistModels(_.values(labels)),
t.persistModels(labels),
t.persistModels(messages),
t.persistModels(threads)
])