National Preventative Mechanism

    olive-pathway

    0.5.5 • Public • Published

    Learning pathway components for react

    Reputation Point

    import React from "react";
    
    import { ReputationPoint } from "olive-pathway";
    import "olive-pathway/dist/gamification.css";
    
    function App() {
      const activities = [
        {
          _id: "628756eb558702ac7bf25600",
          activity: "6284ccad9ca1a52174fe3d34",
          name: "Access Contents",
        },
        {
          _id: "628756eb558702ac7bf25601",
          activity: "6284ccad9ca1a52174fe3d35",
          name: "Start Online Course",
        },
      ];
    
      return (
        <ReputationPoint
          activities={activities}
          token="your_auth_token"
          apiurl="your_api_url"
        />
      );
    }

    Learning Pathway

    import React from "react";
    
    import { Pathway } from "olive-pathway";
    import "olive-pathway/dist/gamification.css";
    
    function App() {
      const courses = {
        // labelKey and valueKey can be changed according to the data
        labelKey: "label",
        valueKey: "value",
        data: [
          {
            label: "course0",
            value: "course0",
          },
          {
            label: "course1",
            value: "course1",
          },
        ],
      };
    
      const vouchers = {
        // labelKey and valueKey can be changed according to the data
        labelKey: "title",
        valueKey: "code",
        data: [
          { title: "Voucher1", code: "12gddeg" },
          { title: "Voucher2", code: "45432fdgfs" },
        ],
      };
    
      const data = [
        {
          key: "C_S", // For Courses or similar data
          data: courses,
          component: {
            name: "Course",
            rules: ["isStarted", "isCompleted", "progress"],
          },
        },
        {
          key: "C_R", // For Credit or similar data
          component: { name: "Credit", rules: ["totalCreditValue"] },
        },
        {
          key: "V_C", // For Voucher Codes or similar data
          data: vouchers,
          component: { name: "Voucher Code", rules: ["isUsed"] },
        },
      ];
    
      return (
        <Pathway
          token="your_auth_token"
          apiurl="your_api_url"
          data={data}
          rules={["isStarted", "isCompleted", "progress"]} // array of strings
        />
      );
    }

    Install

    npm i olive-pathway

    DownloadsWeekly Downloads

    149

    Version

    0.5.5

    License

    none

    Unpacked Size

    1.39 MB

    Total Files

    12

    Last publish

    Collaborators

    • developer-olivegroup