Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
02d5f0a
added cometchat, configured, added route, added nav item
0xSero Jan 16, 2023
a6bf1d3
no ssr
0xSero Jan 16, 2023
c657ca7
fix ssr bs
0xSero Jan 17, 2023
81b889d
group chat set up properly, all data hardcoded todo: use Safe's data …
0xSero Jan 18, 2023
dea038d
add wallet hooks to chat service
0xSero Jan 20, 2023
5adef77
add safe data, connect groups to correct UID
0xSero Jan 23, 2023
e9cf60c
login, privacy, auto, join, group users
0xSero Jan 24, 2023
dc5290b
fix some stuff
0xSero Jan 24, 2023
e76c269
fix the no message was problem with p_id
0xSero Jan 24, 2023
dee15a8
chat stuff
0xSero Jan 24, 2023
a62274e
tx history
0xSero Jan 25, 2023
17ee4f9
add tx history to chat
0xSero Jan 27, 2023
4a5b723
smthbng
0xSero Jan 30, 2023
e77fb1e
fixed a bunch of shit related to queues and api keys
0xSero Feb 1, 2023
a5d4b01
console
0xSero Feb 1, 2023
ff48c2f
Rename src/pages/chat.tsx to src/pages/chat/chat.tsx
danielfetz Feb 2, 2023
3bd4942
Styling - Complete rehaul of web app - work in progress (#2)
danielfetz Feb 6, 2023
b2c17ce
Update styles.module.css
danielfetz Feb 16, 2023
a5d66e6
Update colors-dark.ts
danielfetz Feb 16, 2023
bc80927
Update colors.ts
danielfetz Feb 16, 2023
34a450e
Update styles.module.css
danielfetz Feb 16, 2023
9644d05
Update styles.module.css
danielfetz Feb 16, 2023
a1851dd
Update styles.module.css
danielfetz Feb 16, 2023
a4af105
Update index.tsx
danielfetz Feb 16, 2023
b05e4ba
Update styles.module.css
danielfetz Feb 16, 2023
d86b2c9
Update index.tsx
danielfetz Feb 16, 2023
3d4401e
Update styles.module.css
danielfetz Feb 16, 2023
3c248d9
Update styles.module.css
danielfetz Feb 16, 2023
b084abc
Update index.tsx
danielfetz Feb 16, 2023
6b36208
Update styles.module.css
danielfetz Feb 16, 2023
9b3db29
Update index.tsx
danielfetz Feb 17, 2023
bcda1f8
Update styles.module.css
danielfetz Feb 17, 2023
d06e4c8
Update index.tsx
danielfetz Feb 17, 2023
4fc31e4
Update styles.module.css
danielfetz Feb 17, 2023
cb6710a
Update index.tsx
danielfetz Feb 17, 2023
e8dfe94
Update styles.module.css
danielfetz Feb 17, 2023
0af6886
Update index.tsx
danielfetz Feb 17, 2023
334c0e6
Update index.tsx
danielfetz Feb 17, 2023
536abc1
Update index.tsx
danielfetz Feb 17, 2023
ba1d73a
Update index.tsx
danielfetz Feb 17, 2023
fac3da7
Update styles.module.css
danielfetz Feb 17, 2023
3942d0f
Merge pull request #6 from 0xDecentra/decentra-styling-final
0xSero Feb 24, 2023
11c9f78
create storage key for groups
0xSero Mar 3, 2023
9bf317e
create folders and allow for adding safes to folders: todo: clean up …
0xSero Mar 7, 2023
3207677
folder system with delete, and add
0xSero Mar 16, 2023
17d0a6f
s
0xSero Mar 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
{
"extends": ["next", "prettier", "plugin:prettier/recommended"],
"rules": {
"@next/next/no-img-element": "off",
"unused-imports/no-unused-imports-ts": "error",
"@typescript-eslint/consistent-type-imports": "error",
"no-constant-condition": "warn"
},
"ignorePatterns": ["node_modules/", ".next/", ".github/"],
"plugins": ["unused-imports", "@typescript-eslint"]
}

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"lint"
],
"dependencies": {
"@cometchat-pro/chat": "3.0.10",
"@date-io/date-fns": "^2.15.0",
"@emotion/cache": "^11.10.1",
"@emotion/react": "^11.10.0",
Expand Down Expand Up @@ -79,6 +80,7 @@
"react-papaparse": "^4.0.2",
"react-qr-reader": "2.2.1",
"react-redux": "^8.0.2",
"react-toastify": "^9.1.1",
"semver": "^7.3.7"
},
"devDependencies": {
Expand Down
113 changes: 113 additions & 0 deletions src/components/chat/folder.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { useEffect, useState, type ReactElement } from 'react'
import Button from '@mui/material/Button'
import AddIcon from '@/public/images/common/add.svg'
import SafeListItem from '../sidebar/SafeListItem'
import SvgIcon from '@mui/material/SvgIcon'
import css from './styles.module.css'

//@ts-ignore
const Folder = ({group}): ReactElement => {
const [safeAddress, setSafeAddress] = useState<string>('');
const [safes, setSafes] = useState<string[]>(['']);

window?.addEventListener('storage', () => {
const items = JSON.parse(localStorage.getItem(group)!);
// const myArray = items.split(",");
if (items) {
setSafes(items);
}
})

useEffect(() => {
const activeGroups = async () =>{
const items = JSON.parse(localStorage.getItem(group)!);
// const myArray = items.split(",");
if (items) {
setSafes(items);
}
}
activeGroups()
window.addEventListener('storage', activeGroups)
return () => {
window.removeEventListener('storage', activeGroups)
}
}, [localStorage.getItem(group)]);

const addSafeToFolder = async () => {
const safes = JSON.parse(localStorage.getItem(group)!);
if (safes) {
localStorage.setItem(group, JSON.stringify([...safes, safeAddress]));
} else {
localStorage.setItem(group, JSON.stringify([safeAddress]));
}
window.dispatchEvent(new Event("storage"));
}

const deleteSafeFromFolder = async () => {
const safes = JSON.parse(localStorage.getItem(group)!);
const updated = safes.filter((address: string) => address !== safeAddress)
if (updated) {
localStorage.setItem(group, JSON.stringify(updated));
} else {
localStorage.setItem(group, JSON.stringify([safeAddress]));
}
window.dispatchEvent(new Event("storage"));
}

const handleSetSafeAddress = (address: string) => {
setSafeAddress(address)
}

const deleteFolder = async () => {
console.log(group)
await localStorage.removeItem(group);
window.dispatchEvent(new Event("storage"));
}

return (
<div className={css.group}>
<h3>{group}</h3>
<button onClick={() => deleteFolder()}>Delete Folder</button>
<div className={css.header}>
<label>Add Safe</label>
<input value={safeAddress} onChange={(e) => handleSetSafeAddress(e.target.value)} placeholder={'Safe address'}/>
<Button
disableElevation
className={css.addbutton}
size="small"
variant="outlined"
onClick={() => addSafeToFolder()}
startIcon={<SvgIcon component={AddIcon} inheritViewBox fontSize="small" />}
>
Add
</Button>
<Button
disableElevation
className={css.addbutton}
size="small"
variant="outlined"
onClick={() => deleteSafeFromFolder()}
startIcon={<SvgIcon component={AddIcon} inheritViewBox fontSize="small" />}
>
Delete
</Button>
</div>

<>
{
safes.map((safe) => {
return <SafeListItem
key={safe}
address={safe}
chainId={'137'}
closeDrawer={() => {}}
shouldScrollToSafe={true}
/>
})
}
</>
</div>
)
}

export default Folder
70 changes: 70 additions & 0 deletions src/components/chat/groups.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { useEffect, useState, type ReactElement } from 'react'
import Track from '@/components/common/Track'
import Button from '@mui/material/Button'
import SvgIcon from '@mui/material/SvgIcon'
import Folder from './folder'
import AddIcon from '@/public/images/common/add.svg'
import css from './styles.module.css'
import { OVERVIEW_EVENTS } from '@/services/analytics'

const GroupList = (): ReactElement => {
const [groups, setGroups] = useState<string[]>([]);
const [folderName, setFolderName] = useState<string | undefined>();

useEffect(() => {
const activeGroups = async () =>{
const items = JSON.parse(localStorage.getItem('folders')!);
// const myArray = items.split(",");
if (items) {
setGroups(items);
}
}
activeGroups()
window.addEventListener('storage', activeGroups)
return () => {
window.removeEventListener('storage', activeGroups)
}
}, []);

const createFolder = async () => {
const folders = JSON.parse(localStorage.getItem('folders')!);
localStorage.setItem('folders', JSON.stringify(folders ? [...folders, `${folderName!},`] : [folderName!]));
window.dispatchEvent(new Event("storage"));
}

const nameFolder = (name: string) => {
setFolderName(name)
}

return (
<div className={css.container}>
<div className={css.header}>
<h3>
My Folders
</h3>
<Track {...OVERVIEW_EVENTS.ADD_GROUP}>
<div >
<input type="text" value={folderName} onChange={(e) => nameFolder(e.target.value)}/>
<Button
disableElevation
className={css.addbutton}
size="small"
variant="outlined"
onClick={() => createFolder()}
startIcon={<SvgIcon component={AddIcon} inheritViewBox fontSize="small" />}
>
Add
</Button>
</div>
</Track>
</div>
<>
{groups?.map((group: string) => {
return <div><Folder group={group}/></div>
})}
</>
</div>
)
}

export default GroupList
Loading