From 435f32ac094a096ae45ac49f9a9422d3a86f1008 Mon Sep 17 00:00:00 2001 From: keyan Date: Mon, 13 Dec 2021 13:49:34 -0600 Subject: [PATCH] redo tipping, removing modal, adding walkthrough, setting tipping default to 1 --- components/comment.js | 2 +- components/item-act.js | 10 ++------- components/item.js | 2 +- components/upvote.js | 21 +++++-------------- .../20211213194823_tip_default/migration.sql | 2 ++ prisma/schema.prisma | 2 +- 6 files changed, 12 insertions(+), 27 deletions(-) create mode 100644 prisma/migrations/20211213194823_tip_default/migration.sql diff --git a/components/comment.js b/components/comment.js index 193c7aba..7aa98fd7 100644 --- a/components/comment.js +++ b/components/comment.js @@ -70,7 +70,7 @@ export default function Comment ({
- {item.sats + item.tips} sats + 0 ? ` (${item.meSats} from me)` : ''}`}>{item.sats + item.tips} sats \ {item.boost > 0 && <> diff --git a/components/item-act.js b/components/item-act.js index 37e47906..4e7f71c8 100644 --- a/components/item-act.js +++ b/components/item-act.js @@ -1,7 +1,7 @@ import { InputGroup, Modal } from 'react-bootstrap' import React, { useState, useCallback, useContext, useRef, useEffect } from 'react' import * as Yup from 'yup' -import { Checkbox, Form, Input, SubmitButton } from './form' +import { Form, Input, SubmitButton } from './form' import { useMe } from './me' export const ItemActContext = React.createContext({ @@ -53,7 +53,7 @@ export function ItemActModal () {
sats} /> -
tip
diff --git a/components/item.js b/components/item.js index 608a0019..a23cfb99 100644 --- a/components/item.js +++ b/components/item.js @@ -47,7 +47,7 @@ export default function Item ({ item, rank, children }) { }
- {item.sats + item.tips} sats + 0 ? ` (${item.meSats} from me)` : ''}`}>{item.sats + item.tips} sats \ {item.boost > 0 && <> diff --git a/components/upvote.js b/components/upvote.js index 7f49c3ea..cac3b4de 100644 --- a/components/upvote.js +++ b/components/upvote.js @@ -7,9 +7,9 @@ import { useFundError } from './fund-error' import ActionTooltip from './action-tooltip' import { useItemAct } from './item-act' import { useMe } from './me' +import Rainbow from '../lib/rainbow' import { useRef, useState } from 'react' import LongPressable from 'react-longpressable' -import Rainbow from '../lib/rainbow' import { Overlay, Popover } from 'react-bootstrap' const getColor = (meSats) => { @@ -18,7 +18,7 @@ const getColor = (meSats) => { } const idx = Math.min( - Math.floor((Math.log(meSats) / Math.log(100000)) * (Rainbow.length - 1)), + Math.floor((Math.log(meSats) / Math.log(10000)) * (Rainbow.length - 1)), Rainbow.length - 1) return Rainbow[idx] } @@ -34,7 +34,7 @@ const UpvotePopover = ({ target, show, handleClose }) => ( - Press bolt again to tip 1 sat + Press bolt again to tip 1 sat. @@ -51,7 +51,8 @@ const TipPopover = ({ target, show, handleClose }) => ( - Press and hold bolt to tip a custom amount +
Press and hold bolt to tip a custom amount.
+
As you tip more, the bolt color follows the rainbow.
@@ -72,11 +73,6 @@ export default function UpVote ({ item, className }) { }` ) - // TODO: 1. create functions that updates user to say that they've performed the - // actions so they don't get reprompted, 2. check that the user hasn't been prompted - // before prompting ... we can probably just create one toggle function for each - // that does these checks - const setVoteShow = (yes) => { if (!me) return @@ -178,8 +174,6 @@ export default function UpVote ({ item, className }) { } const noSelfTips = item?.meVote && item?.mine - // 12 px default height - const cover = (item?.meSats < 10 ? ((10 - item.meSats) / 10.0) : 0) * 12 const color = getColor(item?.meSats) return ( @@ -266,11 +260,6 @@ export default function UpVote ({ item, className }) { e.stopPropagation() }} /> -
{ - e.stopPropagation() - }} style={{ top: item?.parentId ? '9px' : '4px', height: `${cover}px` }} - />
diff --git a/prisma/migrations/20211213194823_tip_default/migration.sql b/prisma/migrations/20211213194823_tip_default/migration.sql new file mode 100644 index 00000000..8524c42e --- /dev/null +++ b/prisma/migrations/20211213194823_tip_default/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "users" ALTER COLUMN "tipDefault" SET DEFAULT 1; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 1edbcdb5..aef7744f 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -33,7 +33,7 @@ model User { freeComments Int @default(5) freePosts Int @default(2) checkedNotesAt DateTime? - tipDefault Int @default(0) + tipDefault Int @default(1) pubkey String? @unique theme String @default("light")