storyteller:profiles-react-materialize

v0.1.0Published 10 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Client side for storyteller:profiles-server package in React and Materialize CSS. Build on top of socialize:user-profile package.

UNDER DEVELOPMENT

Adds the following components to the storyteller:accounts-react-materialize package settings page:

  • WIP

User profile page

Creates a user profile page to display all the information to everyone.

WIP: Integrates with other socialize packages to add more interactivity to the profile page.

Routes

1//user profiles
2FlowRouter.route("/profile", {
3  name: "profile-personal",
4  triggersEnter: [usersOnly, checkForProfile],
5  action: () => {
6    ReactLayout.render(MainLayout, { content: <UserProfile user={Meteor.users.findOne(Meteor.userId())} />,
7     footer: "long"})
8  }
9})
10
11FlowRouter.route("/profile/:username", {
12  name: "profile",
13  triggersEnter: [checkForProfile],
14  action: (params, queryParams) => {
15   //check if user exists
16   if(params.username !== null && ! Meteor.users({username: params.username})){
17     //show 404
18     console.log("User not found!")
19   }
20
21   //if username null, go to the currently logged in user
22   if(params.username === null){
23     if(Meteor.userId()){
24       FlowRouter.go("/profile")
25     } else {
26       //show 404
27       console.log("User not found!")
28     }
29   }
30   ReactLayout.render(MainLayout, { content: <UserProfile user={params.username} />,
31    footer: "long"})
32 }
33})
34
35function checkForProfile(context){
36  Meteor.call("checkForProfile", context.params.username);
37}

Loader

The code allows for you to add your own custom loader. Just name the component Loader and it will work.