diff --git a/src/Components/Map/Subcomponents/Controls/GratitudeControl.tsx b/src/Components/Map/Subcomponents/Controls/GratitudeControl.tsx
index 158b9619..a8f7109b 100644
--- a/src/Components/Map/Subcomponents/Controls/GratitudeControl.tsx
+++ b/src/Components/Map/Subcomponents/Controls/GratitudeControl.tsx
@@ -1,8 +1,11 @@
import { useNavigate } from "react-router-dom"
+import { useAuth } from "../../../Auth";
export const GratitudeControl = () => {
const navigate = useNavigate();
- return (
+ const {isAuthenticated} = useAuth();
+
+ if(isAuthenticated) return (
{
@@ -22,4 +25,5 @@ export const GratitudeControl = () => {
)
+ else return (<>>);
}
diff --git a/src/Components/Profile/Templates/TabsView.tsx b/src/Components/Profile/Templates/TabsView.tsx
index cea2ea31..accb7928 100644
--- a/src/Components/Profile/Templates/TabsView.tsx
+++ b/src/Components/Profile/Templates/TabsView.tsx
@@ -5,7 +5,7 @@ import { ActionButton } from '../Subcomponents/ActionsButton'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useAddFilterTag } from '../../Map/hooks/useFilter'
import { Item, Tag } from 'utopia-ui/dist/types'
-import { useNavigate } from 'react-router-dom'
+import { Link, useNavigate } from 'react-router-dom'
import { useItems } from '../../Map/hooks/useItems'
import { useAssetApi } from '../../AppShell/hooks/useAssets'
import { timeAgo } from '../../../Utils/TimeAgo'
@@ -21,7 +21,7 @@ export const TabsView = ({ attestations, userType, item, offers, needs, relation
const items = useItems();
const assetsApi = useAssetApi();
- const {user} = useAuth();
+ const { user } = useAuth();
const getUserProfile = (id: string) => {
return items.find(i => i.user_created.id === id && i.layer?.itemType.name === userType)
@@ -79,41 +79,41 @@ export const TabsView = ({ attestations, userType, item, offers, needs, relation
-
- {attestations.filter(a => a.to.some(t => t.directus_users_id == item.user_created.id)).map((a, i) =>
- |
-
- {a.emoji}
-
-
- |
-
- {a.text}
-
- |
-
-
-
-
- 
-
-
-
- {getUserProfile(a.user_created.id)?.name}
- {timeAgo(a.date_created)}
-
-
-
- |
-
-
-
)}
-
+
+ {attestations
+ .filter(a => a.to.some(t => t.directus_users_id == item.user_created.id))
+ .sort((a, b) => new Date(b.date_created).getTime() - new Date(a.date_created).getTime())
+ .map((a, i) => (
+
+ |
+
+ {a.emoji}
+
+ |
+
+ {a.text}
+ |
+
+
+
+
+
+ 
+
+
+
+ {getUserProfile(a.user_created.id)?.name}
+ {timeAgo(a.date_created)}
+
+
+
+ |
+
+ ))}
+
@@ -123,7 +123,7 @@ export const TabsView = ({ attestations, userType, item, offers, needs, relation
<>
- updateActiveTab(3)} />
+ updateActiveTab(3)} />
diff --git a/src/Components/Templates/AttestationForm.tsx b/src/Components/Templates/AttestationForm.tsx
index 3b080e58..399eb9fc 100644
--- a/src/Components/Templates/AttestationForm.tsx
+++ b/src/Components/Templates/AttestationForm.tsx
@@ -7,6 +7,7 @@ import { Link, useNavigate } from 'react-router-dom';
import { useRef, useState } from 'react';
import { Item, ItemsApi } from '../../types';
import { useEffect } from 'react';
+import { toast } from 'react-toastify';
export const AttestationForm = ({api}:{api?:ItemsApi
}) => {
@@ -38,15 +39,27 @@ export const AttestationForm = ({api}:{api?:ItemsApi}) => {
const sendAttestation = async () => {
const to : Array = [];
users?.map(u => to.push({ directus_users_id: u.user_created.id }));
- console.log(to);
-
- api?.createItem && api.createItem({
- text: inputValue,
- emoji: selectedEmoji,
- color: selectedColor,
- shape: selectedShape,
- to: to
- }).then(()=> navigate("/"))
+
+
+ api?.createItem && toast.promise(
+ api.createItem({
+ text: inputValue,
+ emoji: selectedEmoji,
+ color: selectedColor,
+ shape: selectedShape,
+ to: to
+ }), {
+ pending: 'creating attestation ...',
+ success: 'Attestation created',
+ error: {
+ render({ data }) {
+ return `${data}`
+ },
+ },
+ })
+ .then( () => navigate("/item/" + items.find(i => i.user_created.id===to[0].directus_users_id && i.layer?.itemType.name==="player")?.id+"?tab=2")
+ )
+
}
const [selectedEmoji, setSelectedEmoji] = useState('select badge');
diff --git a/src/Components/Templates/EmojiPicker.tsx b/src/Components/Templates/EmojiPicker.tsx
index dcffc671..4f7f7be5 100644
--- a/src/Components/Templates/EmojiPicker.tsx
+++ b/src/Components/Templates/EmojiPicker.tsx
@@ -12,7 +12,7 @@ export const EmojiPicker = ({selectedEmoji, selectedColor, selectedShape, setSel
'๐', 'โ๏ธ', '๐งฉ','๐ก', '๐', '๐ฌ',
'๐ ', '๐ป', '๐น', '๐จ', '๐', '๐',
'โฝ๏ธ', '๐งต', '๐', '๐ฑ',
- '๐', '๐ช', '๐', '๐',
+ '๐', '๐ช', '๐', '๐น',
'๐ฅ', '๐ฅ', '๐ฅ', '๐ฅ'];
const shapes = ["squircle", "circle", "hexagon-2"];