Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/cosmwasm-launchpad
Browse files Browse the repository at this point in the history
  • Loading branch information
WaDadidou committed Nov 8, 2024
2 parents 48df8ee + 695c877 commit 8c554e1
Show file tree
Hide file tree
Showing 32 changed files with 303 additions and 267 deletions.
36 changes: 0 additions & 36 deletions assets/icons/logo-simple.svg

This file was deleted.

1 change: 0 additions & 1 deletion gno/p/dao_voting_group/voting_group_test.gno
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dao_voting_group

import (
"std"
"testing"

dao_interfaces "gno.land/p/teritori/dao_interfaces"
Expand Down
2 changes: 1 addition & 1 deletion gno/p/markdown_utils/markdown_utils.gno
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ func Indent(markdown string) string {
// thanks copilot this is perfect xD
// I just renamed it, AddIndentationLevelToMarkdownTitles was too long

// blockchain + ai, invest quick!!!!
// blockchain + ai, invest quick!!!!
4 changes: 4 additions & 0 deletions gno/r/dao_realm/dao_realm.gno
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"gno.land/p/teritori/dao_utils"
voting_group "gno.land/p/teritori/dao_voting_group"
"gno.land/r/teritori/dao_registry"
"gno.land/r/teritori/social_feeds"
"gno.land/r/teritori/tori"
)

Expand Down Expand Up @@ -66,6 +67,9 @@ func init() {
func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler {
return tori.NewChangeAdminHandler()
},
func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler {
return social_feeds.NewCreatePostHandler()
},
}

daoCore = dao_core.NewDAOCore(votingModuleFactory, proposalModulesFactories, messageHandlersFactories)
Expand Down
5 changes: 0 additions & 5 deletions gno/r/dao_realm/dao_realm_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ package dao_realm

import (
"fmt"
"std"
"testing"

"gno.land/p/demo/json"
dao_core "gno.land/p/teritori/dao_core"
dao_interfaces "gno.land/p/teritori/dao_interfaces"
proposal_single "gno.land/p/teritori/dao_proposal_single"
"gno.land/p/teritori/dao_voting_group"
"gno.land/p/teritori/havl"
"gno.land/r/demo/users"
)

func TestInit(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion gno/r/dao_realm/gno.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
gno.land/p/teritori/dao_utils v0.0.0-latest
gno.land/p/teritori/dao_voting_group v0.0.0-latest
gno.land/p/teritori/havl v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
gno.land/r/teritori/dao_registry v0.0.0-latest
gno.land/r/teritori/social_feeds v0.0.0-latest
gno.land/r/teritori/tori v0.0.0-latest
)
1 change: 1 addition & 0 deletions gno/r/social_feeds/feeds.gno
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ var (
//----------------------------------------
// Constants

// Feed name must be 3-30 characters long, starting with a lowercase letter
var reName = regexp.MustCompile(`^[a-z]+[_a-z0-9]{2,29}$`)
4 changes: 0 additions & 4 deletions gno/r/social_feeds/feeds_test.gno
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package social_feeds

import (
"encoding/base64"
"fmt"
"std"
"strconv"
"strings"
"testing"

"gno.land/p/demo/avl"
"gno.land/p/demo/testutils"
ujson "gno.land/p/teritori/ujson"
)
Expand Down
77 changes: 75 additions & 2 deletions gno/r/social_feeds/messages.gno
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package social_feeds

import (
"strconv"
"strings"

"gno.land/p/demo/json"
Expand Down Expand Up @@ -63,8 +64,7 @@ func (msg *ExecutableMessageBanPost) String() string {
return strings.Join(ss, "\n---\n")
}

type BanPostHandler struct {
}
type BanPostHandler struct{}

var _ dao_interfaces.MessageHandler = (*BanPostHandler)(nil)

Expand All @@ -84,3 +84,76 @@ func (h BanPostHandler) Type() string {
func (h BanPostHandler) Instantiate() dao_interfaces.ExecutableMessage {
return &ExecutableMessageBanPost{}
}

// Create a new post
type ExecutableMessageCreatePost struct {
FeedID FeedID
ParentID PostID
Category uint64
Metadata string
}

var _ dao_interfaces.ExecutableMessage = (*ExecutableMessageCreatePost)(nil)

func (msg ExecutableMessageCreatePost) Type() string {
return "gno.land/r/teritori/social_feeds.CreatePost"
}

func (msg *ExecutableMessageCreatePost) ToJSON() *json.Node {
return json.ObjectNode("", map[string]*json.Node{
"feedId": jsonutil.IntNode(int(msg.FeedID)),
"parentId": jsonutil.IntNode(int(msg.ParentID)),
"category": jsonutil.IntNode(int(msg.Category)),
"metadata": json.StringNode("", msg.Metadata),
})
}

func (msg *ExecutableMessageCreatePost) FromJSON(ast *json.Node) {
obj := ast.MustObject()
msg.FeedID = FeedID(jsonutil.MustInt(obj["feedId"]))
msg.ParentID = PostID(jsonutil.MustInt(obj["parentId"]))
msg.Category = uint64(jsonutil.MustInt(obj["category"]))
msg.Metadata = obj["metadata"].MustString()
}

func (msg *ExecutableMessageCreatePost) String() string {
var ss []string
ss = append(ss, msg.Type())

feed := getFeed(msg.FeedID)
s := ""

if feed != nil {
s += "Feed: " + feed.name + " (" + feed.id.String() + ")"
s += "\nParent: " + msg.ParentID.String()
s += "\nCategory: " + strconv.Itoa(int(msg.Category))
s += "\nMetadata: " + msg.Metadata
} else {
s += "Feed: " + msg.FeedID.String() + " (not found)"
}

ss = append(ss, s)

return strings.Join(ss, "\n---\n")
}

type CreatePostHandler struct{}

var _ dao_interfaces.MessageHandler = (*CreatePostHandler)(nil)

func NewCreatePostHandler() *CreatePostHandler {
return &CreatePostHandler{}
}

func (h *CreatePostHandler) Execute(iMsg dao_interfaces.ExecutableMessage) {
msg := iMsg.(*ExecutableMessageCreatePost)
CreatePost(msg.FeedID, msg.ParentID, msg.Category, msg.Metadata)
}

func (h CreatePostHandler) Type() string {
return ExecutableMessageCreatePost{}.Type()
}

func (h CreatePostHandler) Instantiate() dao_interfaces.ExecutableMessage {
return &ExecutableMessageCreatePost{}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"@types/leaflet": "^1.9.12",
"@types/leaflet.markercluster": "^1.5.4",
"@types/papaparse": "^5.3.14",
"@types/pluralize": "^0.0.33",
"assert": "^2.1.0",
"axios": "^1.6.2",
"bech32": "^2.0.0",
Expand Down Expand Up @@ -127,6 +128,7 @@
"osmojs": "16.9.0",
"papaparse": "^5.4.1",
"plausible-tracker": "^0.3.8",
"pluralize": "^8.0.0",
"protobufjs": "^7.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
38 changes: 38 additions & 0 deletions packages/components/ImageBackgroundLogoText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { FC } from "react";
import { ImageBackground, ImageSourcePropType, TextStyle } from "react-native";

import { BrandText } from "./BrandText";
import { SVG } from "./SVG";
import { SpacerColumn } from "./spacer";

import logoSVG from "@/assets/logos/logo-white.svg";
import { useMaxResolution } from "@/hooks/useMaxResolution";
import { fontSemibold22, fontSemibold28 } from "@/utils/style/fonts";
import { RESPONSIVE_BREAKPOINT_S } from "@/utils/style/layout";

export const ImageBackgroundLogoText: FC<{
text: string;
backgroundImage: ImageSourcePropType;
}> = ({ text, backgroundImage }) => {
const { width } = useMaxResolution();
const isSmallScreen = width < RESPONSIVE_BREAKPOINT_S;
const logoSize = isSmallScreen ? 70 : 88;
const fontStyle: TextStyle = isSmallScreen ? fontSemibold22 : fontSemibold28;
const height = 380;

return (
<ImageBackground
source={backgroundImage}
style={{
alignItems: "center",
justifyContent: "center",
height,
width: "100%",
}}
>
<SVG source={logoSVG} width={logoSize} height={logoSize} />
<SpacerColumn size={1} />
<BrandText style={fontStyle}>{text}</BrandText>
</ImageBackground>
);
};
39 changes: 0 additions & 39 deletions packages/components/IntroLogoText.tsx

This file was deleted.

10 changes: 9 additions & 1 deletion packages/components/WalletProviderIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import keplrSVG from "../../assets/icons/keplr.svg";
import leapSVG from "../../assets/icons/leap-cosmos-logo.svg";
import metamaskSVG from "../../assets/icons/metamask.svg";
import warningSVG from "../../assets/icons/warning.svg";
import { errorColor } from "../utils/style/colors";
import { WalletProvider } from "../utils/walletProvider";

export const WalletProviderIcon: React.FC<{
Expand All @@ -23,7 +24,14 @@ export const WalletProviderIcon: React.FC<{
case WalletProvider.Adena:
return <SVG width={size} height={size} source={adenaSVG} />;
case WalletProvider.Gnotest:
return <SVG width={size} height={size} source={warningSVG} />;
return (
<SVG
width={size}
height={size}
source={warningSVG}
color={errorColor}
/>
);
default:
return <View style={{ width: size, height: size }} />;
}
Expand Down
Loading

0 comments on commit 8c554e1

Please sign in to comment.