diff --git a/components/item.module.css b/components/item.module.css
index 92828e9f..2f6e3c75 100644
--- a/components/item.module.css
+++ b/components/item.module.css
@@ -41,13 +41,20 @@ a.link:visited {
.other {
font-size: 80%;
color: var(--theme-grey);
- margin-bottom: .15rem;
}
.item {
display: flex;
justify-content: flex-start;
min-width: 0;
+ margin-bottom: .45rem;
+}
+
+.item .companyImage {
+ border-radius: 100%;
+ align-self: center;
+ margin-right: 0.5rem;
+ margin-left: 0.3rem;
}
.itemDead {
@@ -62,10 +69,17 @@ a.link:visited {
.hunk {
overflow: hidden;
width: 100%;
- margin-bottom: .3rem;
line-height: 1.06rem;
}
+/* .itemJob .hunk {
+ align-self: center;
+}
+
+.itemJob .rank {
+ align-self: center;
+} */
+
.main {
display: flex;
align-items: baseline;
diff --git a/components/items.js b/components/items.js
index a8aaef7b..4f4c5002 100644
--- a/components/items.js
+++ b/components/items.js
@@ -1,5 +1,6 @@
import { useQuery } from '@apollo/client'
-import Item, { ItemJob, ItemSkeleton } from './item'
+import Item, { ItemSkeleton } from './item'
+import ItemJob from './item-job'
import styles from './items.module.css'
import { ITEMS } from '../fragments/items'
import MoreFooter from './more-footer'
diff --git a/components/job-form.js b/components/job-form.js
index e94c4572..122c2d35 100644
--- a/components/job-form.js
+++ b/components/job-form.js
@@ -1,6 +1,6 @@
import { Checkbox, Form, Input, MarkdownInput, SubmitButton } from './form'
import TextareaAutosize from 'react-textarea-autosize'
-import { InputGroup, Form as BForm, Col } from 'react-bootstrap'
+import { InputGroup, Form as BForm, Col, Image } from 'react-bootstrap'
import * as Yup from 'yup'
import { useEffect, useState } from 'react'
import Info from './info'
@@ -10,6 +10,7 @@ import { useLazyQuery, gql, useMutation } from '@apollo/client'
import { useRouter } from 'next/router'
import Link from 'next/link'
import { usePrice } from './price'
+import Avatar from './avatar'
Yup.addMethod(Yup.string, 'or', function (schemas, msg) {
return this.test({
@@ -47,6 +48,7 @@ export default function JobForm ({ item, sub }) {
const storageKeyPrefix = item ? undefined : `${sub.name}-job`
const router = useRouter()
const [monthly, setMonthly] = useState(satsMin2Mo(item?.maxBid || sub.baseCost))
+ const [logoId, setLogoId] = useState(item?.uploadId)
const [getAuctionPosition, { data }] = useLazyQuery(gql`
query AuctionPosition($id: ID, $bid: Int!) {
auctionPosition(sub: "${sub.name}", id: $id, bid: $bid)
@@ -54,10 +56,10 @@ export default function JobForm ({ item, sub }) {
{ fetchPolicy: 'network-only' })
const [upsertJob] = useMutation(gql`
mutation upsertJob($id: ID, $title: String!, $company: String!, $location: String,
- $remote: Boolean, $text: String!, $url: String!, $maxBid: Int!, $status: String) {
+ $remote: Boolean, $text: String!, $url: String!, $maxBid: Int!, $status: String, $logo: Int) {
upsertJob(sub: "${sub.name}", id: $id, title: $title, company: $company,
location: $location, remote: $remote, text: $text,
- url: $url, maxBid: $maxBid, status: $status) {
+ url: $url, maxBid: $maxBid, status: $status, logo: $logo) {
id
}
}`
@@ -122,6 +124,7 @@ export default function JobForm ({ item, sub }) {
sub: sub.name,
maxBid: Number(maxBid),
status,
+ logo: Number(logoId),
...values
}
})
@@ -136,6 +139,15 @@ export default function JobForm ({ item, sub }) {
}
})}
>
+
+
diff --git a/components/user-header.js b/components/user-header.js
index 9aec579b..525b0fb9 100644
--- a/components/user-header.js
+++ b/components/user-header.js
@@ -1,8 +1,8 @@
-import { Button, InputGroup, Image, Modal, Form as BootstrapForm } from 'react-bootstrap'
+import { Button, InputGroup, Image } from 'react-bootstrap'
import Link from 'next/link'
import { useRouter } from 'next/router'
import Nav from 'react-bootstrap/Nav'
-import { useRef, useState } from 'react'
+import { useState } from 'react'
import { Form, Input, SubmitButton } from './form'
import * as Yup from 'yup'
import { gql, useApolloClient, useMutation } from '@apollo/client'
@@ -13,10 +13,7 @@ import QRCode from 'qrcode.react'
import LightningIcon from '../svgs/bolt.svg'
import ModalButton from './modal-button'
import { encodeLNUrl } from '../lib/lnurl'
-import Upload from './upload'
-import EditImage from '../svgs/image-edit-fill.svg'
-import Moon from '../svgs/moon-fill.svg'
-import AvatarEditor from 'react-avatar-editor'
+import Avatar from './avatar'
export default function UserHeader ({ user }) {
const [editting, setEditting] = useState(false)
@@ -25,6 +22,24 @@ export default function UserHeader ({ user }) {
const client = useApolloClient()
const [setName] = useMutation(NAME_MUTATION)
+ const [setPhoto] = useMutation(
+ gql`
+ mutation setPhoto($photoId: ID!) {
+ setPhoto(photoId: $photoId)
+ }`, {
+ update (cache, { data: { setPhoto } }) {
+ cache.modify({
+ id: `User:${user.id}`,
+ fields: {
+ photoId () {
+ return setPhoto
+ }
+ }
+ })
+ }
+ }
+ )
+
const isMe = me?.name === user.name
const Satistics = () => {isMe ? `${user.sats} sats \\ ` : ''}{user.stacked} stacked
@@ -54,7 +69,14 @@ export default function UserHeader ({ user }) {
src={user.photoId ? `https://${process.env.NEXT_PUBLIC_AWS_UPLOAD_BUCKET}.s3.amazonaws.com/${user.photoId}` : '/dorian400.jpg'} width='135' height='135'
className={styles.userimg}
/>
- {isMe && }
+ {isMe &&
+ {
+ const { error } = await setPhoto({ variables: { photoId } })
+ if (error) {
+ console.log(error)
+ }
+ }}
+ />}
{editting
@@ -161,92 +183,3 @@ export default function UserHeader ({ user }) {
>
)
}
-
-function PhotoEditor ({ userId }) {
- const [uploading, setUploading] = useState()
- const [editProps, setEditProps] = useState()
- const ref = useRef()
- const [scale, setScale] = useState(1)
-
- const [setPhoto] = useMutation(
- gql`
- mutation setPhoto($photoId: ID!) {
- setPhoto(photoId: $photoId)
- }`, {
- update (cache, { data: { setPhoto } }) {
- cache.modify({
- id: `User:${userId}`,
- fields: {
- photoId () {
- return setPhoto
- }
- }
- })
- }
- }
- )
-
- return (
- <>
-
setEditProps(null)}
- >
- setEditProps(null)}>X
-
-
-
- setScale(parseFloat(e.target.value))}
- min={1} max={2} step='0.05'
- defaultValue={scale} custom
- />
-
-
-
-
-
-
- {uploading
- ?
- : }
-
}
- onError={e => {
- console.log(e)
- setUploading(false)
- }}
- onSelect={(file, upload) => {
- setEditProps({ file, upload })
- }}
- onSuccess={async key => {
- const { error } = await setPhoto({ variables: { photoId: key } })
- if (error) {
- console.log(error)
- }
- setUploading(false)
- }}
- onStarted={() => {
- setUploading(true)
- }}
- />
- >
- )
-}
diff --git a/fragments/items.js b/fragments/items.js
index 23459c22..e131881a 100644
--- a/fragments/items.js
+++ b/fragments/items.js
@@ -31,6 +31,7 @@ export const ITEM_FIELDS = gql`
baseCost
}
status
+ uploadId
mine
root {
id
diff --git a/fragments/subs.js b/fragments/subs.js
index cea8ec61..fc6025d0 100644
--- a/fragments/subs.js
+++ b/fragments/subs.js
@@ -29,6 +29,11 @@ export const SUB_ITEMS = gql`
cursor
items {
...ItemFields
+ position
+ },
+ pins {
+ ...ItemFields
+ position
}
}
}
diff --git a/prisma/migrations/20220720211644_item_uploads/migration.sql b/prisma/migrations/20220720211644_item_uploads/migration.sql
new file mode 100644
index 00000000..c4b17159
--- /dev/null
+++ b/prisma/migrations/20220720211644_item_uploads/migration.sql
@@ -0,0 +1,11 @@
+/*
+ Warnings:
+
+ - A unique constraint covering the columns `[itemId]` on the table `Upload` will be added. If there are existing duplicate values, this will fail.
+
+*/
+-- AlterTable
+ALTER TABLE "Item" ADD COLUMN "uploadId" INTEGER;
+
+-- CreateIndex
+CREATE UNIQUE INDEX "Upload.itemId_unique" ON "Upload"("itemId");
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index bca8d0c4..32980bb9 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -72,7 +72,7 @@ model Upload {
width Int?
height Int?
item Item? @relation(fields: [itemId], references: [id])
- itemId Int?
+ itemId Int? @unique
user User @relation(name: "Uploads", fields: [userId], references: [id])
userId Int
@@ -161,6 +161,8 @@ model Item {
pinId Int?
weightedVotes Float @default(0)
boost Int @default(0)
+ uploadId Int?
+ upload Upload?
// if sub is null, this is the main sub
sub Sub? @relation(fields: [subName], references: [name])
@@ -178,8 +180,7 @@ model Item {
longitude Float?
remote Boolean?
- User User[]
- Upload Upload[]
+ User User[]
@@index([createdAt])
@@index([userId])
@@index([parentId])
diff --git a/public/jobs-default.png b/public/jobs-default.png
new file mode 100644
index 00000000..89f6d793
Binary files /dev/null and b/public/jobs-default.png differ
diff --git a/svgs/mail-open-fill.svg b/svgs/mail-open-fill.svg
new file mode 100644
index 00000000..cd75d9cb
--- /dev/null
+++ b/svgs/mail-open-fill.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/svgs/mail-open-line.svg b/svgs/mail-open-line.svg
new file mode 100644
index 00000000..64b33032
--- /dev/null
+++ b/svgs/mail-open-line.svg
@@ -0,0 +1 @@
+
\ No newline at end of file